From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 2/2] pinctrl: Rockchip: abort GPIO probe gracefully on out-of-range alias id
Date: Fri, 14 Jan 2022 09:47:57 +0100 [thread overview]
Message-ID: <20220114084757.311697-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20220114084757.311697-1-a.fatoum@pengutronix.de>
&{/aliases} { gpio120 = &gpio1; } so far led to an out-of-bounds read
when probing &gpio1. Fix this.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/pinctrl/pinctrl-rockchip.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index ea748b600419..869cce198239 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -334,6 +334,8 @@ static int rockchip_gpio_probe(struct device_d *dev)
int ret, bankno;
bankno = of_alias_get_id(dev->device_node, "gpio");
+ if (bankno >= ctrl->nr_banks)
+ bankno = -EINVAL;
if (bankno < 0)
return bankno;
--
2.30.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2022-01-14 8:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-14 8:47 [PATCH 1/2] pinctrl: rockchip: use alias rather than full of name Ahmad Fatoum
2022-01-14 8:47 ` Ahmad Fatoum [this message]
2022-01-14 8:49 ` Ahmad Fatoum
2022-01-14 9:33 ` 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=20220114084757.311697-2-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.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