Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hwmon: (pmbus/ibm-cffps) Prevent writing on_off_config with bad data

If the user write parameters resulted in no bytes being written to the
temporary buffer, then ON_OFF_CONFIG will be written with uninitialized
data. Prevent this by bailing out in this case.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
Link: https://lore.kernel.org/r/1578411640-16929-1-git-send-email-eajames@linux.ibm.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>

authored by

Eddie James and committed by
Guenter Roeck
d9c8ae69 39292371

+1 -1
+1 -1
drivers/hwmon/pmbus/ibm-cffps.c
··· 250 250 pmbus_set_page(psu->client, 0); 251 251 252 252 rc = simple_write_to_buffer(&data, 1, ppos, buf, count); 253 - if (rc < 0) 253 + if (rc <= 0) 254 254 return rc; 255 255 256 256 rc = i2c_smbus_write_byte_data(psu->client,