Skip to content

Commit d531baf

Browse files
committed
gpiolib: Range-check gpio numbers
Just pretend this check was present from day one. Signed-off-by: Phil Elwell <[email protected]>
1 parent ddaafeb commit d531baf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pinctrl/gpiolib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ static int gpio_get_interface(unsigned gpio,
101101

102102
int gpio_num_is_valid(unsigned gpio)
103103
{
104-
return !!gpio_names[gpio];
104+
return gpio < MAX_GPIO_PINS && !!gpio_names[gpio];
105105
}
106106

107107
GPIO_DIR_T gpio_get_dir(unsigned gpio)

0 commit comments

Comments
 (0)