summaryrefslogtreecommitdiff
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorEddie James <eajames@linux.ibm.com>2020-01-07 09:40:40 -0600
committerGuenter Roeck <linux@roeck-us.net>2020-01-23 13:15:10 -0800
commitd9c8ae69b9962197883f79c7df3fd562cc52b21a (patch)
tree43ebf331dc34a603177768f2fc54712f64aa4bc3 /drivers/hwmon
parent392923715d8b0bbb7e72567fd4090e92bd5a9a3b (diff)
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>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/pmbus/ibm-cffps.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/hwmon/pmbus/ibm-cffps.c b/drivers/hwmon/pmbus/ibm-cffps.c
index 1c91ee1f9926..3795fe55b84f 100644
--- a/drivers/hwmon/pmbus/ibm-cffps.c
+++ b/drivers/hwmon/pmbus/ibm-cffps.c
@@ -250,7 +250,7 @@ static ssize_t ibm_cffps_debugfs_write(struct file *file,
pmbus_set_page(psu->client, 0);
rc = simple_write_to_buffer(&data, 1, ppos, buf, count);
- if (rc < 0)
+ if (rc <= 0)
return rc;
rc = i2c_smbus_write_byte_data(psu->client,