IPMI: Small updates and fixes

Some cleanups for device changes coming, and some range checks on data
 coming from a host to a BMC.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEE/Q1c5nzg9ZpmiCaGYfOMkJGb/4EFAmaWdSMACgkQYfOMkJGb
 /4Hn+A//QT1AcV7cA42vvaH7Ohm+bjmfCa8lzWk72VlbSB0+83wdt9J9yBvLmNDw
 Js4oRPt8eWft13+C/E7UlYuIEpLo6Vj3pGJ261hT3UteD3oIzZiF+fWzIFSYEjJz
 xvGnTiqsiXCunwEjBfXvXWaGL9KXMsnkIyzLWHvD5qCaQqki5IJBQ2Ky9OnjRhri
 sLITwdt+/aFDsPQuKaxZLkLs1GEdrR4q7pqVqyJvsaz/sV0t44rlf/kbcGIU8ow8
 Mw53sRG1sN9tRGQvO1WUkkO63ZHu6BvhdflqWNEimS5/+vC/kQX6Dlfpd7CJU/QR
 6M8maSIKq3w/YM7ieMsT7r+fJtYo5PE3MohjxCKaxPWJuNX+DJGOSiI/mXSe4hPM
 mGBpqmbUQKZVuOtd8cPxU0V8EGrhCNOfWnmzxV1JSobD0bcEqNEITQzwtMb/V4pi
 YJPdyUmfZnRXhhtO4Y5fD7Si3NR3BluiQB50LfV/YSBDb8VRsZoFWdW0uJxz+Z5Y
 g1gqXsDbt7i8YDiSd+7zYTmh1NOmjd9tDp6YwA+5yEvoYgM/uuXhYlOsqQXCPm1D
 jYV8fQaRWjsiocWH1HI4QJx4LRZG8FTXhvKufiQPsqZPqcezPp1nodONZhZk2xEf
 luYUT+TvtLKYdq7LJvvNJRrIiCLgw5Zxi76mi2+rkd97FYoshWM=
 =AnXj
 -----END PGP SIGNATURE-----

Merge tag 'for-linus-6.11-1' of https://github.com/cminyard/linux-ipmi

Pull IPMI updates from Corey Minyard:
 "Some cleanups for device changes coming, and some range checks on data
  coming from a host to a BMC"

* tag 'for-linus-6.11-1' of https://github.com/cminyard/linux-ipmi:
  ipmi: Drop explicit initialization of struct i2c_device_id::driver_data to 0
  ipmi: ssif_bmc: prevent integer overflow on 32bit systems
This commit is contained in:
Linus Torvalds 2024-07-17 17:09:15 -07:00
commit 221fd1e154
4 changed files with 11 additions and 9 deletions

View File

@ -350,8 +350,8 @@ static void ipmb_remove(struct i2c_client *client)
}
static const struct i2c_device_id ipmb_id[] = {
{ "ipmb-dev", 0 },
{},
{ "ipmb-dev" },
{}
};
MODULE_DEVICE_TABLE(i2c, ipmb_id);

View File

@ -561,8 +561,8 @@ MODULE_DEVICE_TABLE(of, of_ipmi_ipmb_match);
#endif
static const struct i2c_device_id ipmi_ipmb_id[] = {
{ DEVICE_NAME, 0 },
{},
{ DEVICE_NAME },
{}
};
MODULE_DEVICE_TABLE(i2c, ipmi_ipmb_id);

View File

@ -2049,7 +2049,7 @@ static int dmi_ipmi_probe(struct platform_device *pdev)
#endif
static const struct i2c_device_id ssif_id[] = {
{ DEVICE_NAME, 0 },
{ DEVICE_NAME },
{ }
};
MODULE_DEVICE_TABLE(i2c, ssif_id);

View File

@ -177,13 +177,15 @@ static ssize_t ssif_bmc_write(struct file *file, const char __user *buf, size_t
unsigned long flags;
ssize_t ret;
if (count > sizeof(struct ipmi_ssif_msg))
if (count < sizeof(msg.len) ||
count > sizeof(struct ipmi_ssif_msg))
return -EINVAL;
if (copy_from_user(&msg, buf, count))
return -EFAULT;
if (!msg.len || count < sizeof_field(struct ipmi_ssif_msg, len) + msg.len)
if (!msg.len || msg.len > IPMI_SSIF_PAYLOAD_MAX ||
count < sizeof_field(struct ipmi_ssif_msg, len) + msg.len)
return -EINVAL;
spin_lock_irqsave(&ssif_bmc->lock, flags);
@ -850,8 +852,8 @@ static const struct of_device_id ssif_bmc_match[] = {
MODULE_DEVICE_TABLE(of, ssif_bmc_match);
static const struct i2c_device_id ssif_bmc_id[] = {
{ DEVICE_NAME, 0 },
{ },
{ DEVICE_NAME },
{ }
};
MODULE_DEVICE_TABLE(i2c, ssif_bmc_id);