提交 d9c8ae69 编写于 作者: E Eddie James 提交者: Guenter Roeck

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: NEddie James <eajames@linux.ibm.com>
Link: https://lore.kernel.org/r/1578411640-16929-1-git-send-email-eajames@linux.ibm.comSigned-off-by: NGuenter Roeck <linux@roeck-us.net>
上级 39292371
...@@ -250,7 +250,7 @@ static ssize_t ibm_cffps_debugfs_write(struct file *file, ...@@ -250,7 +250,7 @@ static ssize_t ibm_cffps_debugfs_write(struct file *file,
pmbus_set_page(psu->client, 0); pmbus_set_page(psu->client, 0);
rc = simple_write_to_buffer(&data, 1, ppos, buf, count); rc = simple_write_to_buffer(&data, 1, ppos, buf, count);
if (rc < 0) if (rc <= 0)
return rc; return rc;
rc = i2c_smbus_write_byte_data(psu->client, rc = i2c_smbus_write_byte_data(psu->client,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册