[patch 08/10] hwmon: (lm85) Fix function RANGE_TO_REG()

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-kernel@...>, <stable@...>
Cc: Justin Forbes <jmforbes@...>, Zwane Mwaikambo <zwane@...>, Theodore Ts'o <tytso@...>, Randy Dunlap <rdunlap@...>, Dave Jones <davej@...>, Chuck Wolber <chuckw@...>, Chris Wedgwood <reviews@...>, Michael Krufky <mkrufky@...>, Chuck Ebbert <cebbert@...>, Domenico Andreoli <cavokz@...>, Willy Tarreau <w@...>, Rodrigo Rubira Branco <rbranco@...>, <torvalds@...>, <akpm@...>, <alan@...>, Mark M. Hoffman <mhoffman@...>, Jean Delvare <khali@...>
Date: Monday, June 23, 2008 - 7:04 pm

2.6.25.9-stable review patch.  If anyone has any objections, please let
us know.

------------------ 
From: Jean Delvare <khali@linux-fr.org>

Function RANGE_TO_REG() is broken. For a requested range of 2000 (2
degrees C), it will return an index value of 15, i.e. 80.0 degrees C,
instead of the expected index value of 0. All other values are handled
properly, just 2000 isn't.

The bug was introduced back in November 2004 by this patch:
http://git.kernel.org/?p=linux/kernel/git/tglx/history.git;a=commit;h=1c28d80f19922403...

In Linus' kernel I decided to rewrite the whole function in a way
which was more obviously correct. But for -stable let's just do the
minimal fix.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 drivers/hwmon/lm85.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/hwmon/lm85.c
+++ b/drivers/hwmon/lm85.c
@@ -192,7 +192,7 @@ static int RANGE_TO_REG( int range )
 {
 	int i;
 
-	if ( range < lm85_range_map[0] ) { 
+	if (range <= lm85_range_map[0]) {
 		return 0 ;
 	} else if ( range > lm85_range_map[15] ) {
 		return 15 ;

-- 
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch 00/10] 2.6.28.9-rc2 review, Greg KH, (Mon Jun 23, 7:04 pm)
Re: [patch 00/10] 2.6.28.9-rc2 review, Greg KH, (Mon Jun 23, 7:22 pm)
[patch 10/10] Fix ZERO_PAGE breakage with vmware, Greg KH, (Mon Jun 23, 7:04 pm)
Re: [patch 10/10] Fix ZERO_PAGE breakage with vmware, Linus Torvalds, (Mon Jun 23, 7:28 pm)
[patch 08/10] hwmon: (lm85) Fix function RANGE_TO_REG(), Greg KH, (Mon Jun 23, 7:04 pm)