Skip to content

Commit 62ed853

Browse files
Dan CarpenterWim Van Sebroeck
Dan Carpenter
authored and
Wim Van Sebroeck
committed
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 <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Signed-off-by: Wim Van Sebroeck <[email protected]>
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

+1-1
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)