From: Greg Kroah-Hartman Date: Tue, 22 Nov 2005 18:30:14 +0000 (-0800) Subject: added 3 hwmon patches X-Git-Tag: v2.6.14.3~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d34f8290afa4e3590264ce03abd03255f5f03256;p=thirdparty%2Fkernel%2Fstable-queue.git added 3 hwmon patches --- diff --git a/queue/hwmon-fix-missing-it87-fan-div-init.patch b/queue/hwmon-fix-missing-it87-fan-div-init.patch new file mode 100644 index 00000000000..124c51b5b06 --- /dev/null +++ b/queue/hwmon-fix-missing-it87-fan-div-init.patch @@ -0,0 +1,41 @@ +From khali@linux-fr.org Mon Nov 21 10:05:47 2005 +Date: Mon, 21 Nov 2005 19:22:16 +0100 +From: Jean Delvare +To: Greg KH +Cc: Nicolas Mailhot +Subject: hwmon: Fix missing it87 fan div init +Message-Id: <20051121192216.3a72d4c4.khali@linux-fr.org> + +Fix a bug where setting the low fan speed limits will not work if no +data was ever read through the sysfs interface and the fan clock +dividers have not been explicitely set yet either. The reason is that +data->fan_div[nr] may currently be used before it is initialized from +the chip register values. The fix is to explicitely initialize +data->fan_div[nr] before using it. + +Bug reported, and fix tested, by Nicolas Mailhot. + +Signed-off-by: Jean Delvare +Signed-off-by: Greg Kroah-Hartman +--- + drivers/hwmon/it87.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- linux-2.6.14.2.orig/drivers/hwmon/it87.c ++++ linux-2.6.14.2/drivers/hwmon/it87.c +@@ -522,8 +522,15 @@ static ssize_t set_fan_min(struct device + struct i2c_client *client = to_i2c_client(dev); + struct it87_data *data = i2c_get_clientdata(client); + int val = simple_strtol(buf, NULL, 10); ++ u8 reg = it87_read_value(client, IT87_REG_FAN_DIV); + + down(&data->update_lock); ++ switch (nr) { ++ case 0: data->fan_div[nr] = reg & 0x07; break; ++ case 1: data->fan_div[nr] = (reg >> 3) & 0x07; break; ++ case 2: data->fan_div[nr] = (reg & 0x40) ? 3 : 1; break; ++ } ++ + data->fan_min[nr] = FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr])); + it87_write_value(client, IT87_REG_FAN_MIN(nr), data->fan_min[nr]); + up(&data->update_lock); diff --git a/queue/hwmon-lm78-fix-vid.patch b/queue/hwmon-lm78-fix-vid.patch new file mode 100644 index 00000000000..c46f72cac58 --- /dev/null +++ b/queue/hwmon-lm78-fix-vid.patch @@ -0,0 +1,31 @@ +From khali@linux-fr.org Mon Nov 14 14:00:46 2005 +Date: Mon, 14 Nov 2005 23:11:45 +0100 +From: Jean Delvare +To: Greg KH +Subject: hwmon: Fix lm78 VID conversion +Message-Id: <20051114231145.670478d0.khali@linux-fr.org> +Content-Disposition: inline; filename=hwmon-lm78-fix-vid.patch + +Fix the lm78 VID reading, which I accidentally broke while making +this driver use the common vid_from_reg function rather than +reimplementing its own in 2.6.14-rc1. + +I'm not proud of it, trust me. + +Signed-off-by: Jean Delvare +Signed-off-by: Greg Kroah-Hartman +--- + drivers/hwmon/lm78.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- linux-2.6.14.2.orig/drivers/hwmon/lm78.c ++++ linux-2.6.14.2/drivers/hwmon/lm78.c +@@ -451,7 +451,7 @@ static DEVICE_ATTR(fan3_div, S_IRUGO, sh + static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char *buf) + { + struct lm78_data *data = lm78_update_device(dev); +- return sprintf(buf, "%d\n", vid_from_reg(82, data->vid)); ++ return sprintf(buf, "%d\n", vid_from_reg(data->vid, 82)); + } + static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL); + diff --git a/queue/hwmon-w83627hf-missing-in0-limit-check.patch b/queue/hwmon-w83627hf-missing-in0-limit-check.patch new file mode 100644 index 00000000000..bb1c48630f4 --- /dev/null +++ b/queue/hwmon-w83627hf-missing-in0-limit-check.patch @@ -0,0 +1,44 @@ +From khali@linux-fr.org Mon Nov 14 13:55:35 2005 +Date: Mon, 14 Nov 2005 23:08:38 +0100 +From: Jean Delvare +To: Greg KH +Cc: Yuan Mu +Subject: [PATCH] hwmon: Fix missing boundary check when setting W83627THF in0 limits +Message-Id: <20051114230838.37a9f2d8.khali@linux-fr.org> +Content-Disposition: inline; filename=hwmon-w83627hf-missing-in0-limit-check.patch + +From: Yuan Mu + +Add SENSORS_LIMIT in store VCore limit functions. This fixes a potential +u8 overflow on out-of-range user input. + +Signed-off-by: Jean Delvare +Signed-off-by: Greg Kroah-Hartman +--- + drivers/hwmon/w83627hf.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +--- linux-2.6.14.2.orig/drivers/hwmon/w83627hf.c ++++ linux-2.6.14.2/drivers/hwmon/w83627hf.c +@@ -454,7 +454,9 @@ static ssize_t store_regs_in_min0(struct + (w83627thf == data->type || w83637hf == data->type)) + + /* use VRM9 calculation */ +- data->in_min[0] = (u8)(((val * 100) - 70000 + 244) / 488); ++ data->in_min[0] = ++ SENSORS_LIMIT(((val * 100) - 70000 + 244) / 488, 0, ++ 255); + else + /* use VRM8 (standard) calculation */ + data->in_min[0] = IN_TO_REG(val); +@@ -479,7 +481,9 @@ static ssize_t store_regs_in_max0(struct + (w83627thf == data->type || w83637hf == data->type)) + + /* use VRM9 calculation */ +- data->in_max[0] = (u8)(((val * 100) - 70000 + 244) / 488); ++ data->in_max[0] = ++ SENSORS_LIMIT(((val * 100) - 70000 + 244) / 488, 0, ++ 255); + else + /* use VRM8 (standard) calculation */ + data->in_max[0] = IN_TO_REG(val); diff --git a/queue/series b/queue/series index 7d51e3b8557..89b08cecc94 100644 --- a/queue/series +++ b/queue/series @@ -19,3 +19,7 @@ fix-sending-extension-headers-before.patch 4GB-memory-intel-dual-core.patch acpi-fix-null-deref-in-video-lcd-brightness.patch drivers-isdn-hardware-eicon-os_4bri.c-correct-the-xdiloadfile-signature.patch +hwmon-w83627hf-missing-in0-limit-check.patch +hwmon-lm78-fix-vid.patch +hwmon-fix-missing-it87-fan-div-init.patch +