From: "Uwe Kleine-König" <ukleinek@kernel.org>
To: kr494167@gmail.com
Cc: george.moussalem@outlook.com, quic_devipriy@quicinc.com,
andersson@kernel.org, baruch.siach@siklu.com,
linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] pwm: ipq: prevent potential 32-bit integer overflow in hi_div calculation
Date: Mon, 7 Sep 2026 11:51:45 +0200 [thread overview]
Message-ID: <ap6IbbFqQsBvVSm9@monoceros> (raw)
In-Reply-To: <20260724044854.33274-1-kr494167@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1113 bytes --]
Hello,
On Fri, Jul 24, 2026 at 10:18:54AM +0530, kr494167@gmail.com wrote:
> From: Surendra Singh Chouhan <kr494167@gmail.com>
>
> In ipq_pwm_get_state(), hi_div was calculated as:
> hi_div = hi_dur * (pre_div + 1);
>
> hi_dur and (pre_div + 1) are both unsigned int (32-bit) values.
> Evaluating their multiplication using 32-bit arithmetic before assigning to
> the 64-bit u64 hi_div variable can overflow 32-bit unsigned math.
>
> While effective_div explicitly uses (u64)(pwm_div + 1) * (pre_div + 1) to
> prevent overflow, hi_div was missing the (u64) cast.
>
> Fix this by casting hi_dur to (u64) before multiplication, matching the
> precision used for effective_div.
>
> Fixes: c436e3e9c265 ("pwm: Driver for qualcomm ipq6018 pwm block")
> Signed-off-by: Surendra Singh Chouhan <kr494167@gmail.com>
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git pwm/for-next
. Did you find this issue by code review or does it trigger easily? If
the latter you might be able to convince me to send this patch to Linus
before 7.3.
Best regards
Uwe
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2026-09-07 9:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-24 4:48 kr494167
2026-09-07 9:51 ` Uwe Kleine-König [this message]
2026-09-07 10:23 ` Surendra Singh
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=ap6IbbFqQsBvVSm9@monoceros \
--to=ukleinek@kernel.org \
--cc=andersson@kernel.org \
--cc=baruch.siach@siklu.com \
--cc=george.moussalem@outlook.com \
--cc=kr494167@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=quic_devipriy@quicinc.com \
/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®