mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-12-09 19:42:00 +01:00
gpio: Verify validity of pin offsets when looking up names
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>
This commit is contained in:
parent
c5b68ef8af
commit
390ccffe07
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user