Skip to content

Commit 6e551bf

Browse files
Srinivas Neelibrgl
authored andcommitted
gpio: gpio-xilinx: Add check if width exceeds 32
Add check to see if gpio-width property does not exceed 32. If it exceeds then return -EINVAL. Signed-off-by: Srinivas Neeli <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Acked-by: William Breathitt Gray <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent 26b0477 commit 6e551bf

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/gpio/gpio-xilinx.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,9 @@ static int xgpio_probe(struct platform_device *pdev)
589589
if (of_property_read_u32(np, "xlnx,gpio-width", &chip->gpio_width[0]))
590590
chip->gpio_width[0] = 32;
591591

592+
if (chip->gpio_width[0] > 32)
593+
return -EINVAL;
594+
592595
spin_lock_init(&chip->gpio_lock);
593596

594597
if (of_property_read_u32(np, "xlnx,is-dual", &is_dual))
@@ -613,6 +616,8 @@ static int xgpio_probe(struct platform_device *pdev)
613616
&chip->gpio_width[1]))
614617
chip->gpio_width[1] = 32;
615618

619+
if (chip->gpio_width[1] > 32)
620+
return -EINVAL;
616621
}
617622

618623
chip->gc.base = -1;

0 commit comments

Comments
 (0)