Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpio: gpiolib-devprop: Check chip->parent pointer before dereferencing

Confirm the chip->parent is valid before dereferencing because
the parent parameter is optional.

Signed-off-by: Thor Thayer <tthayer@opensource.altera.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Thor Thayer and committed by
Linus Walleij
5a195c6d f85522c2

+5
+5
drivers/gpio/gpiolib-devprop.c
··· 31 31 const char **names; 32 32 int ret, i; 33 33 34 + if (!chip->parent) { 35 + dev_warn(&gdev->dev, "GPIO chip parent is NULL\n"); 36 + return; 37 + } 38 + 34 39 ret = device_property_read_string_array(chip->parent, "gpio-line-names", 35 40 NULL, 0); 36 41 if (ret < 0)