From: Guenter Roeck <linux@roeck-us.net>
To: Huibin Hong <huibin.hong@rock-chips.com>
Cc: wim@iguana.be, linux-watchdog@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org
Subject: Re: [PATCH] watchdog: dw_wdt: fix overflow issue in dw_wdt_top_in_seconds
Date: Mon, 14 Aug 2017 08:37:52 -0700 [thread overview]
Message-ID: <20170814153752.GB7025@roeck-us.net> (raw)
In-Reply-To: <1501159843-6623-1-git-send-email-huibin.hong@rock-chips.com>
On Thu, Jul 27, 2017 at 08:50:43PM +0800, Huibin Hong wrote:
> If top is 15, (1 << (16 + top)) may be negative.
>
> Change-Id: I76e4a603a54f093e64a4b266008570e3afcdb35a
No Change-Id in upstream patches, please.
> Signed-off-by: Huibin Hong <huibin.hong@rock-chips.com>
I am having trouble applying this patch. What is its baseline version ?
Guenter
> ---
> drivers/watchdog/dw_wdt.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
> index 6ea0634..059c974 100644
> --- a/drivers/watchdog/dw_wdt.c
> +++ b/drivers/watchdog/dw_wdt.c
> @@ -81,7 +81,9 @@ static inline int dw_wdt_top_in_seconds(unsigned top)
> * There are 16 possible timeout values in 0..15 where the number of
> * cycles is 2 ^ (16 + i) and the watchdog counts down.
> */
> - return (1 << (16 + top)) / clk_get_rate(dw_wdt.clk);
> + unsigned int cycles = 1 << (16 + top);
> +
> + return cycles / clk_get_rate(dw_wdt.clk);
> }
>
> static int dw_wdt_get_top(void)
> --
> 1.9.1
>
>
> --
> 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:[~2017-08-14 15:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-27 12:50 Huibin Hong
2017-08-14 15:37 ` 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=20170814153752.GB7025@roeck-us.net \
--to=linux@roeck-us.net \
--cc=huibin.hong@rock-chips.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.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
all inboxes | Powered by JetHome®