This is a note to let you know that I've just added the patch titled hwmon: (pmbus) Use long variables for register to data conversions
to the 2.6.39-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: hwmon-pmbus-use-long-variables-for-register-to-data.patch and it can be found in the queue-2.6.39 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <sta...@kernel.org> know about it. >From f450c1504d3ff6aace3927c805bdea0ac0669efd Mon Sep 17 00:00:00 2001 From: Guenter Roeck <guenter.ro...@ericsson.com> Date: Sun, 10 Jul 2011 19:31:29 -0700 Subject: hwmon: (pmbus) Use long variables for register to data conversions From: Guenter Roeck <guenter.ro...@ericsson.com> commit f450c1504d3ff6aace3927c805bdea0ac0669efd upstream. Using integer variable types for register to data conversions can cause overflows especially for power calculations, which are in microwatt. Use long variables instead. Signed-off-by: Guenter Roeck <guenter.ro...@ericsson.com> Acked-by: Jean Delvare <kh...@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gre...@suse.de> --- drivers/hwmon/pmbus_core.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) --- a/drivers/hwmon/pmbus_core.c +++ b/drivers/hwmon/pmbus_core.c @@ -355,8 +355,8 @@ static struct pmbus_data *pmbus_update_d * Convert linear sensor values to milli- or micro-units * depending on sensor type. */ -static int pmbus_reg2data_linear(struct pmbus_data *data, - struct pmbus_sensor *sensor) +static long pmbus_reg2data_linear(struct pmbus_data *data, + struct pmbus_sensor *sensor) { s16 exponent; s32 mantissa; @@ -390,15 +390,15 @@ static int pmbus_reg2data_linear(struct else val >>= -exponent; - return (int)val; + return val; } /* * Convert direct sensor values to milli- or micro-units * depending on sensor type. */ -static int pmbus_reg2data_direct(struct pmbus_data *data, - struct pmbus_sensor *sensor) +static long pmbus_reg2data_direct(struct pmbus_data *data, + struct pmbus_sensor *sensor) { long val = (s16) sensor->data; long m, b, R; @@ -433,12 +433,12 @@ static int pmbus_reg2data_direct(struct R++; } - return (int)((val - b) / m); + return (val - b) / m; } -static int pmbus_reg2data(struct pmbus_data *data, struct pmbus_sensor *sensor) +static long pmbus_reg2data(struct pmbus_data *data, struct pmbus_sensor *sensor) { - int val; + long val; if (data->info->direct[sensor->class]) val = pmbus_reg2data_direct(data, sensor); @@ -612,7 +612,7 @@ static int pmbus_get_boolean(struct pmbu if (!s1 && !s2) *val = !!regval; else { - int v1, v2; + long v1, v2; struct pmbus_sensor *sensor1, *sensor2; sensor1 = &data->sensors[s1]; @@ -654,7 +654,7 @@ static ssize_t pmbus_show_sensor(struct if (sensor->data < 0) return sensor->data; - return snprintf(buf, PAGE_SIZE, "%d\n", pmbus_reg2data(data, sensor)); + return snprintf(buf, PAGE_SIZE, "%ld\n", pmbus_reg2data(data, sensor)); } static ssize_t pmbus_set_sensor(struct device *dev, Patches currently in stable-queue which might be from guenter.ro...@ericsson.com are queue-2.6.39/hwmon-pmbus-improve-fan-detection.patch queue-2.6.39/hwmon-pmbus-use-long-variables-for-register-to-data.patch queue-2.6.39/hwmon-lm95241-fix-chip-detection-code.patch queue-2.6.39/hwmon-pmbus-improve-auto-detection-of-temperature-status.patch queue-2.6.39/hwmon-pmbus-drop-check-for-pmbus-revision-register-in.patch queue-2.6.39/hwmon-pmbus-auto-detect-temp2-and-temp3.patch queue-2.6.39/hwmon-lm95241-fix-negative-temperature-results.patch _______________________________________________ stable mailing list stable@linux.kernel.org http://linux.kernel.org/mailman/listinfo/stable