From: Stefan Ghetu <stefan.ghetu@nxp.com>
To: abelvesa@kernel.org, peng.fan@nxp.com, sboyd@kernel.org,
bmasney+clk@redhat.com, jbrunet+clk@baylibre.com,
Frank.Li@nxp.com, s.hauer@pengutronix.de, daniel.baluta@nxp.com
Cc: kernel@pengutronix.de, festevam@gmail.com,
linux-clk@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
Florin Pavelescu <florin.pavelescu@nxp.com>,
Stefan Ghetu <stefan.ghetu@nxp.com>
Subject: [PATCH v3] clk: imx: pll14xx: Fix potential integer overflow
Date: Mon, 9 Nov 2026 15:40:32 +0200 [thread overview]
Message-ID: <20261109134032.139050-1-stefan.ghetu@nxp.com> (raw)
From: Florin Pavelescu <florin.pavelescu@nxp.com>
Cast to u64, so that multiplications and additions will be done
in 64-bit arithmetic and the possibility of integer overflow is eliminated.
To silence the Coverity warning.
Signed-off-by: Florin Pavelescu <florin.pavelescu@nxp.com>
Signed-off-by: Stefan Ghetu <stefan.ghetu@nxp.com>
---
Changes in v2:
- Drop the redundant (u64) cast on kdiv, as suggested by Frank Li.
Adding a 32-bit value to a u64 already promotes it to u64.
Changes in v3:
- Drop the Fixes tag
drivers/clk/imx/clk-pll14xx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/clk/imx/clk-pll14xx.c b/drivers/clk/imx/clk-pll14xx.c
index c6438144e507..ee9a9e4c392a 100644
--- a/drivers/clk/imx/clk-pll14xx.c
+++ b/drivers/clk/imx/clk-pll14xx.c
@@ -124,7 +124,7 @@ static long pll14xx_calc_rate(struct clk_pll14xx *pll, int mdiv, int pdiv,
u64 fout = prate;
/* fout = (m * 65536 + k) * Fin / (p * 65536) / (1 << sdiv) */
- fout *= (mdiv * 65536 + kdiv);
+ fout *= ((u64)mdiv * 65536 + kdiv);
pdiv *= 65536;
do_div(fout, pdiv << sdiv);
--
2.34.1
reply other threads:[~2026-11-09 13:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261109134032.139050-1-stefan.ghetu@nxp.com \
--to=stefan.ghetu@nxp.com \
--cc=Frank.Li@nxp.com \
--cc=abelvesa@kernel.org \
--cc=bmasney+clk@redhat.com \
--cc=daniel.baluta@nxp.com \
--cc=festevam@gmail.com \
--cc=florin.pavelescu@nxp.com \
--cc=imx@lists.linux.dev \
--cc=jbrunet+clk@baylibre.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peng.fan@nxp.com \
--cc=s.hauer@pengutronix.de \
--cc=sboyd@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
all inboxes | Powered by JetHome®