projects
/
platform
/
kernel
/
u-boot.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c5b68ef
)
gpio: Verify validity of pin offsets when looking up names
author
Samuel Holland
<samuel@sholland.org>
Sat, 11 Sep 2021 22:05:51 +0000
(17:05 -0500)
committer
Tom Rini
<trini@konsulko.com>
Tue, 5 Oct 2021 12:50:15 +0000
(08:50 -0400)
Translation of a pin name to a device+offset should fail if the offset
is larger than the number of pins in the GPIO bank.
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/gpio/gpio-uclass.c
patch
|
blob
|
history
diff --git
a/drivers/gpio/gpio-uclass.c
b/drivers/gpio/gpio-uclass.c
index
bb2f232
..
45a7f8d
100644
(file)
--- a/
drivers/gpio/gpio-uclass.c
+++ b/
drivers/gpio/gpio-uclass.c
@@
-141,7
+141,8
@@
int dm_gpio_lookup_name(const char *name, struct gpio_desc *desc)
if (!strncasecmp(name, uc_priv->bank_name, len)) {
if (!strict_strtoul(name + len, 10, &offset))
- break;
+ if (offset < uc_priv->gpio_count)
+ break;
}
/*