From: Guenter Roeck <linux@roeck-us.net>
To: Dan Carpenter <dan.carpenter@oracle.com>,
Wim Van Sebroeck <wim@iguana.be>
Cc: linux-watchdog@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] watchdog: w83977f_wdt: underflow in wdt_set_timeout()
Date: Fri, 6 Nov 2015 05:58:50 -0800 [thread overview]
Message-ID: <563CB21A.40007@roeck-us.net> (raw)
In-Reply-To: <20151106095631.GA18557@mwanda>
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
>
prev parent reply other threads:[~2015-11-06 13:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-06 9:56 [patch] watchdog: w83977f_wdt: underflow in wdt_set_timeout() Dan Carpenter
2015-11-06 13:58 ` Guenter Roeck [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=563CB21A.40007@roeck-us.net \
--to=linux@roeck-us.net \
--cc=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=wim@iguana.be \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox