lkml.org 
[lkml]   [2011]   [Mar]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] [220/275] hwmon: (sht15) Fix integer overflow in humidity calculation
Date
2.6.35-longterm review patch.  If anyone has any objections, please let me know.

------------------
From: Vivien Didelot <vivien.didelot@savoirfairelinux.com>

commit ccd32e735de7a941906e093f8dca924bb05c5794 upstream.

An integer overflow occurs in the calculation of RHlinear when the
relative humidity is greater than around 30%. The consequence is a subtle
(but noticeable) error in the resulting humidity measurement.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Cc: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
drivers/hwmon/sht15.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6.35.y/drivers/hwmon/sht15.c
===================================================================
--- linux-2.6.35.y.orig/drivers/hwmon/sht15.c 2011-03-29 22:50:29.011516087 -0700
+++ linux-2.6.35.y/drivers/hwmon/sht15.c 2011-03-29 23:03:02.824227904 -0700
@@ -333,11 +333,11 @@

const int c1 = -4;
const int c2 = 40500; /* x 10 ^ -6 */
- const int c3 = -2800; /* x10 ^ -9 */
+ const int c3 = -28; /* x 10 ^ -7 */

RHlinear = c1*1000
+ c2 * data->val_humid/1000
- + (data->val_humid * data->val_humid * c3)/1000000;
+ + (data->val_humid * data->val_humid * c3) / 10000;
return (temp - 25000) * (10000 + 80 * data->val_humid)
/ 1000000 + RHlinear;
}

\
 
 \ /
  Last update: 2011-03-30 23:41    [W:0.985 / U:1.352 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site