From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: mfe@pengutronix.de, Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 2/5] firmware-zynqmp: don't ignore the kstrtouint() result in parse_reg()
Date: Tue, 22 Sep 2026 12:47:53 +0200 [thread overview]
Message-ID: <20260922104813.317584-3-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20260922104813.317584-1-a.fatoum@pengutronix.de>
parse_reg() decodes the index out of the ggs%u/pggs%u parameter names the
driver registers itself, so the conversion can't really fail.
We define __must_check as empty currently, so the __must_check on
kstrtouint() doesn't catch this, but it will once we change the
definition, so prepare for that.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/arm/mach-zynqmp/firmware-zynqmp.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-zynqmp/firmware-zynqmp.c b/arch/arm/mach-zynqmp/firmware-zynqmp.c
index 039a46e76759..d21e2c1137f1 100644
--- a/arch/arm/mach-zynqmp/firmware-zynqmp.c
+++ b/arch/arm/mach-zynqmp/firmware-zynqmp.c
@@ -712,7 +712,11 @@ EXPORT_SYMBOL_GPL(zynqmp_pm_get_eemi_ops);
static bool parse_reg(const char *reg, unsigned *idx)
{
bool pggs = reg[0] == 'p';
- kstrtouint(reg + pggs + sizeof("ggs") - 1, 10, idx);
+
+ /* the names are registered by this driver as ggs%u and pggs%u */
+ if (WARN_ON(kstrtouint(reg + pggs + sizeof("ggs") - 1, 10, idx)))
+ *idx = 0;
+
return pggs;
}
--
2.47.3
next prev parent reply other threads:[~2026-09-22 10:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-22 10:47 [PATCH 0/5] malloc: add __free() cleanup handlers Ahmad Fatoum
2026-09-22 10:47 ` [PATCH 1/5] commands: rksecure: exit if invalid integer passed to -b Ahmad Fatoum
2026-09-22 10:47 ` Ahmad Fatoum [this message]
2026-09-22 10:47 ` [PATCH 3/5] include: compiler: make __must_check a yes-op Ahmad Fatoum
2026-09-22 10:47 ` [PATCH 4/5] malloc: add __free() cleanup handlers Ahmad Fatoum
2026-09-22 10:47 ` [PATCH 5/5] test: self: add cleanup selftest Ahmad Fatoum
2026-09-23 6:33 ` [PATCH 0/5] malloc: add __free() cleanup handlers Sascha Hauer
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=20260922104813.317584-3-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=mfe@pengutronix.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