aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/it87.c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2006-08-28 14:26:22 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2006-09-28 15:31:13 -0700
commitb9e349f710376ef55f200e9fa07e88b4fe2cdf98 (patch)
tree221fe66ca1b1fe93ed1e9cf7b9fa988779d22a11 /drivers/hwmon/it87.c
parent9060f8bdd0c40e31d2be388e59f2dbeea55988a2 (diff)
downloadkernel_samsung_smdk4412-b9e349f710376ef55f200e9fa07e88b4fe2cdf98.zip
kernel_samsung_smdk4412-b9e349f710376ef55f200e9fa07e88b4fe2cdf98.tar.gz
kernel_samsung_smdk4412-b9e349f710376ef55f200e9fa07e88b4fe2cdf98.tar.bz2
it87: Prevent overflow on fan clock divider write
it87: Prevent overflow on fan clock divider write The highest possible clock divider for fan1 and fan2 is 128. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/hwmon/it87.c')
-rw-r--r--drivers/hwmon/it87.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
index 0317e44..fc75fcb 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -198,7 +198,7 @@ static inline u16 FAN16_TO_REG(long rpm)
static int DIV_TO_REG(int val)
{
int answer = 0;
- while ((val >>= 1) != 0)
+ while (answer < 7 && (val >>= 1))
answer++;
return answer;
}
@@ -563,7 +563,7 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr,
struct i2c_client *client = to_i2c_client(dev);
struct it87_data *data = i2c_get_clientdata(client);
- int val = simple_strtol(buf, NULL, 10);
+ unsigned long val = simple_strtoul(buf, NULL, 10);
int i, min[3];
u8 old;