RDMA/ucma: Correct option size check using optlen
[pandora-kernel.git] / drivers / hwmon / smsc47m192.c
index 40b2667..7d1373d 100644 (file)
@@ -84,7 +84,7 @@ static inline u8 IN_TO_REG(unsigned long val, int n)
    REG: 1C/bit, two's complement */
 static inline s8 TEMP_TO_REG(int val)
 {
-       return SENSORS_LIMIT(SCALE(val, 1, 1000), -128000, 127000);
+       return SCALE(SENSORS_LIMIT(val, -128000, 127000), 1, 1000);
 }
 
 static inline int TEMP_FROM_REG(s8 val)
@@ -349,7 +349,13 @@ static ssize_t set_vrm(struct device *dev, struct device_attribute *attr,
                const char *buf, size_t count)
 {
        struct smsc47m192_data *data = dev_get_drvdata(dev);
-       data->vrm = simple_strtoul(buf, NULL, 10);
+       unsigned long val;
+
+       val = simple_strtoul(buf, NULL, 10);
+       if (val > 255)
+               return -EINVAL;
+       data->vrm = val;
        return count;
 }
 static DEVICE_ATTR(vrm, S_IRUGO | S_IWUSR, show_vrm, set_vrm);