Skip to contentSkip to conversation

gpiolib: Fix missing array end sentinel in quirks array

PATCH In review Nicolas Frattaroli 1 participant 2 messages Sep 20, 2022 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpiolib: Fix missing array end sentinel in quirks array

Without the sentinel, the loop never actually terminates if there are no quirks, and wreaks havoc across the kernel resulting in a juicy panic.

Fix this by adding a NULL at the end.

Fixes a2b5e207cade ("gpiolib: rework quirk handling in of_find_gpio()")
---
 drivers/gpio/gpiolib-of.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpio/gpiolib-of.c +1 -0
index 95be5f0d2623..1b60cd04883f 100644
@@ -498,6 +498,7 @@ static const of_find_gpio_quirk of_find_gpio_quirks[] = {
 	of_find_regulator_gpio,
 	of_find_arizona_gpio,
 	of_find_usb_gpio,
+	NULL,
 };
 
 struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id,
Signature · 1 line
2.37.3
#1 lore raw
Quoted 18 lines · On Dienstag, 20. September 2022 16:27:18 CEST Nicolas Frattaroli wrote:

Without the sentinel, the loop never actually terminates if there are no quirks, and wreaks havoc across the kernel resulting in a juicy panic.

Fix this by adding a NULL at the end.

Fixes a2b5e207cade ("gpiolib: rework quirk handling in of_find_gpio()")
---
 drivers/gpio/gpiolib-of.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpio/gpiolib-of.c +0 -0
index 95be5f0d2623..1b60cd04883f 100644

drivers/gpio/gpiolib-of.c static const of_find_gpio_quirk of_find_gpio_quirks[] = { · line 504

Quoted 7 lines
drivers/gpio/gpiolib-of.c +1 -0
@@ -498,6 +498,7 @@ static const of_find_gpio_quirk of_find_gpio_quirks[] = {
 	of_find_regulator_gpio,
 	of_find_arizona_gpio,
 	of_find_usb_gpio,
+	NULL,
 };
 
 struct gpio_desc *of_find_gpio(struct device *dev, const char *con_id,

Disregard this, just saw it was already fixed[1].

Regards,
Nicolas Frattaroli

[1]: https://lore.kernel.org/linux-gpio/CAMRc=MeF-81yottUqqYdHmuFokysyNsXTgU+FOFWv7bL=QMJOg@mail.gmail.com/T/