In of_gpiochip_get_lflags() the local variable xlate_flags is declared without being initialized before its address is passed to of_xlate_and_get_gpiod_flags() when processing a devicetree gpio-hog child node. If a driver uses an of_xlate() callback that doesn't update the flags argument (like gpiochip_fwd_delay_of_xlate()) we'll end up passing that uninitialized value to of_convert_gpio_flags(), potentially misconfiguring the hogged GPIO. Initialize xlate_flags to 0. Cc: stable@vger.kernel.org Fixes: d1d564ec4992 ("gpio: move hogs into GPIO core") Closes: https://sashiko.dev/#/bug/linux-2bb44847-fd6e-406c-878d-9739da2cb8b5 Signed-off-by: Bartosz Golaszewski --- drivers/gpio/gpiolib-of.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index 25b97109f97ea88c83c744e496e24263ee71b8bb..8bc4562608e1141983300132b90758ce68d7625d 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -753,7 +753,7 @@ int of_gpiochip_get_lflags(struct gpio_chip *chip, struct fwnode_reference_args *gpiospec, unsigned long *lflags) { - enum of_gpio_flags xlate_flags; + enum of_gpio_flags xlate_flags = 0; struct of_phandle_args args; struct gpio_desc *desc; --- base-commit: 8b7179210b22f8e48a82c5ceacb9d56a9c4cfec4 change-id: 20261105-gpiolib-of-hog-uninitialized-0159fa4104df Best regards, -- Bartosz Golaszewski