From: Stefan Ghetu <stefan.ghetu@nxp.com>
To: abelvesa@kernel.org, peng.fan@nxp.com, sboyd@kernel.org
Cc: bmasney+clk@redhat.com, jbrunet+clk@baylibre.com,
Frank.Li@nxp.com, s.hauer@pengutronix.de, 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] clk: imx: pll14xx: Fix potential integer overflow
Date: Thu, 5 Nov 2026 11:46:32 +0200 [thread overview]
Message-ID: <20261105094632.159200-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 results will also be 64-bit)
and the possibility of integer overflow is eliminated.
Fixes: 53990cf9d5b48 ("clk: imx: pll14xx: consolidate rate calculation")
Signed-off-by: Florin Pavelescu <florin.pavelescu@nxp.com>
Signed-off-by: Stefan Ghetu <stefan.ghetu@nxp.com>
---
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..08f9d3fbc75f 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 + (u64)kdiv);
pdiv *= 65536;
do_div(fout, pdiv << sdiv);
--
2.34.1
next reply other threads:[~2026-11-05 9:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-05 9:46 Stefan Ghetu [this message]
2026-11-05 17:40 ` Frank Li
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=20261105094632.159200-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=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®