* [patch] watchdog: w83977f_wdt: underflow in wdt_set_timeout()
@ 2015-11-06 9:56 Dan Carpenter
2015-11-06 13:58 ` Guenter Roeck
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-11-06 9:56 UTC (permalink / raw)
To: Wim Van Sebroeck; +Cc: linux-watchdog, kernel-janitors
"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>
diff --git a/drivers/watchdog/w83977f_wdt.c b/drivers/watchdog/w83977f_wdt.c
index 91bf55a..20e2bba 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.
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch] watchdog: w83977f_wdt: underflow in wdt_set_timeout()
2015-11-06 9:56 [patch] watchdog: w83977f_wdt: underflow in wdt_set_timeout() Dan Carpenter
@ 2015-11-06 13:58 ` Guenter Roeck
0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2015-11-06 13:58 UTC (permalink / raw)
To: Dan Carpenter, Wim Van Sebroeck; +Cc: linux-watchdog, kernel-janitors
On 11/06/2015 01:56 AM, Dan Carpenter wrote:
> "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>
> diff --git a/drivers/watchdog/w83977f_wdt.c b/drivers/watchdog/w83977f_wdt.c
> index 91bf55a..20e2bba 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.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-11-06 13:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-06 9:56 [patch] watchdog: w83977f_wdt: underflow in wdt_set_timeout() Dan Carpenter
2015-11-06 13:58 ` Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).