From: Stephen Boyd <sboyd@kernel.org>
To: Anastasia Belova <abelova@astralinux.ru>,
Michael Turquette <mturquette@baylibre.com>
Cc: "Anastasia Belova" <abelova@astralinux.ru>,
"Andreas Färber" <afaerber@suse.de>,
"Manivannan Sadhasivam" <manivannan.sadhasivam@linaro.org>,
linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-actions@lists.infradead.org, linux-kernel@vger.kernel.org,
lvc-project@linuxtesting.org, stable@vger.kernel.org
Subject: Re: [PATCH] clk: actions: prevent overflow in owl_pll_recalc_rate
Date: Thu, 10 Oct 2024 15:21:45 -0700 [thread overview]
Message-ID: <eeb311ff8cbfff0166286d1363c8b7d5.sboyd@kernel.org> (raw)
In-Reply-To: <20240910130640.20631-1-abelova@astralinux.ru>
Quoting Anastasia Belova (2024-09-10 06:06:40)
> In case of OWL S900 SoC clock driver there are cases
> where bfreq = 24000000, shift = 0. If value read from
> CMU_COREPLL or CMU_DDRPLL to val is big enough, an
> overflow may occur.
>
> Add explicit casting to prevent it.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Fixes: 2792c37e94c8 ("clk: actions: Add pll clock support")
> Cc: <stable@vger.kernel.org>
Seems like we don't need these tags because it can't overflow.
> Signed-off-by: Anastasia Belova <abelova@astralinux.ru>
> ---
> drivers/clk/actions/owl-pll.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/clk/actions/owl-pll.c b/drivers/clk/actions/owl-pll.c
> index 155f313986b4..fa17567665ec 100644
> --- a/drivers/clk/actions/owl-pll.c
> +++ b/drivers/clk/actions/owl-pll.c
> @@ -104,7 +104,7 @@ static unsigned long owl_pll_recalc_rate(struct clk_hw *hw,
> val = val >> pll_hw->shift;
> val &= mul_mask(pll_hw);
>
> - return pll_hw->bfreq * val;
> + return (unsigned long)pll_hw->bfreq * val;
I'm lost. Did you intend to cast this to a u64?
prev parent reply other threads:[~2024-10-11 0:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-10 13:06 [PATCH] clk: actions: prevent overflow in owl_pll_recalc_rate Anastasia Belova
2024-09-10 16:52 ` Manivannan Sadhasivam
2024-10-10 22:21 ` Stephen Boyd [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=eeb311ff8cbfff0166286d1363c8b7d5.sboyd@kernel.org \
--to=sboyd@kernel.org \
--cc=abelova@astralinux.ru \
--cc=afaerber@suse.de \
--cc=linux-actions@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lvc-project@linuxtesting.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=mturquette@baylibre.com \
--cc=stable@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).