From: Tom Rini <trini@konsulko.com>
To: Andrew Goodbody <andrew.goodbody@linaro.org>
Cc: Jaehoon Chung <jh80.chung@samsung.com>, u-boot@lists.denx.de
Subject: Re: [PATCH] power: pfuze100: Ensure loop index is incremented
Date: Sun, 31 Aug 2025 09:35:13 -0600 [thread overview]
Message-ID: <20250831153513.GA2800031@bill-the-cat> (raw)
In-Reply-To: <20250703-pfuze100_fix-v1-1-5f838e29d122@linaro.org>
[-- Attachment #1: Type: text/plain, Size: 1022 bytes --]
On Thu, Jul 03, 2025 at 12:31:50PM +0100, Andrew Goodbody wrote:
> The for loop in se_desc uses i as the loop index and also to cause the
> loop to end if the passed in name is not found. However i is not
> incremented which could cause the loop to continue indefinitely and
> access out of bounds memory.
> Add an increment of i to ensure that the loop terminates correctly in
> the case where name is not found.
>
> This issue found by Smatch.
>
> Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
> ---
> drivers/power/regulator/pfuze100.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
I size tested this as part of merging and saw unexpected shrinkage. In
turn, this got me to look harder at the code and I think the best answer
is to refactor things so that se_desc(...) follow the normal (linux
kernel) pattern of for (i = 0; i < ARRAY_SIZE(desc); i++) instead of
being passed size. That's I think the root of this confusion too. I'll
post a patch shortly.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2025-08-31 15:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-03 11:31 [PATCH] power: pfuze100: Ensure loop index is incremented Andrew Goodbody
2025-07-14 12:25 ` Quentin Schulz
2025-08-07 15:04 ` Andrew Goodbody
2025-07-24 9:00 ` Andrew Goodbody
2025-08-31 15:35 ` Tom Rini [this message]
2025-09-13 15:51 ` Tom Rini
2025-09-15 9:45 ` Andrew Goodbody
2025-09-15 17:31 ` Tom Rini
2025-09-16 1:47 ` Peng Fan
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=20250831153513.GA2800031@bill-the-cat \
--to=trini@konsulko.com \
--cc=andrew.goodbody@linaro.org \
--cc=jh80.chung@samsung.com \
--cc=u-boot@lists.denx.de \
/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