Skip to content

Commit 62ed853

Browse files
Dan CarpenterWim Van Sebroeck
authored andcommitted
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>
1 parent 4c30737 commit 62ed853

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/watchdog/w83977f_wdt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ static int wdt_keepalive(void)
224224

225225
static int wdt_set_timeout(int t)
226226
{
227-
int tmrval;
227+
unsigned int tmrval;
228228

229229
/*
230230
* Convert seconds to watchdog counter time units, rounding up.

0 commit comments

Comments
 (0)