From: Shubhrajyoti D Date: Thu, 28 Oct 2010 18:31:44 +0000 (+0200) Subject: hwmon: (lm75) Make the writing to sysfs more robust X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e3cd9528af4d1fd404eefe16e52ae421f99a7817;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git hwmon: (lm75) Make the writing to sysfs more robust Currently we get the checkpatch warning consider using strict_strtol in preference to simple_strtol. Also we should not allow any partially numeric values. Signed-off-by: Shubhrajyoti D Signed-off-by: Jean Delvare --- diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c index ab5b87a81677..5cb79d94a990 100644 --- a/drivers/hwmon/lm75.c +++ b/drivers/hwmon/lm75.c @@ -103,7 +103,12 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *da, struct i2c_client *client = to_i2c_client(dev); struct lm75_data *data = i2c_get_clientdata(client); int nr = attr->index; - long temp = simple_strtol(buf, NULL, 10); + long temp; + int error; + + error = strict_strtol(buf, 10, &temp); + if (error) + return error; mutex_lock(&data->update_lock); data->temp[nr] = LM75_TEMP_TO_REG(temp);