Skip to content

Commit

Permalink
watchdog: w83977f_wdt: underflow in wdt_set_timeout()
Browse files Browse the repository at this point in the history
"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>
  • Loading branch information
Dan Carpenter authored and Wim Van Sebroeck committed Nov 23, 2015
1 parent 4c30737 commit 62ed853
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/watchdog/w83977f_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ static int wdt_keepalive(void)

static int wdt_set_timeout(int t)
{
int tmrval;
unsigned int tmrval;

/*
* Convert seconds to watchdog counter time units, rounding up.
Expand Down

0 comments on commit 62ed853

Please sign in to comment.