Browse Source

watchdog: w83977f_wdt: underflow in wdt_set_timeout()

"t" is controlled by the user.  If "t" is a very large integer then it
could lead to a negative "tmrval".  We cap the upper bound of "tmrval"
but, in the current code, we allow negatives.  This is a bug and it
causes a static checker warning.  Let's make "tmrval" unsigned to avoid
this problem.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Dan Carpenter 9 years ago
parent
commit
62ed853c7d
1 changed files with 1 additions and 1 deletions
  1. 1 1
      drivers/watchdog/w83977f_wdt.c

+ 1 - 1
drivers/watchdog/w83977f_wdt.c

@@ -224,7 +224,7 @@ static int wdt_keepalive(void)
 
 
 static int wdt_set_timeout(int t)
 static int wdt_set_timeout(int t)
 {
 {
-	int tmrval;
+	unsigned int tmrval;
 
 
 	/*
 	/*
 	 * Convert seconds to watchdog counter time units, rounding up.
 	 * Convert seconds to watchdog counter time units, rounding up.