From: Dan Carpenter Date: Fri, 6 Nov 2015 09:56:31 +0000 (+0300) Subject: watchdog: w83977f_wdt: underflow in wdt_set_timeout() X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=62ed853c7de7a77bdf01421fb6836269c9b1aa1f;p=sagit-ice-cold%2Fkernel_xiaomi_msm8998.git 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 Reviewed-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck --- diff --git a/drivers/watchdog/w83977f_wdt.c b/drivers/watchdog/w83977f_wdt.c index 91bf55a20024..20e2bba10400 100644 --- a/drivers/watchdog/w83977f_wdt.c +++ b/drivers/watchdog/w83977f_wdt.c @@ -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.