gpio: gpiolib-devprop: Check chip->parent pointer before dereferencing
PATCH 1/1 gpio: gpiolib-devprop: Check chip->parent pointer before dereferencing
From: Thor Thayer <[email protected]>
Confirm the chip->parent is valid before dereferencing because the parent parameter is optional.
Signed-off-by Thor Thayer <[email protected]>
--- drivers/gpio/gpiolib-devprop.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpio/gpiolib-devprop.c +5 -0
@@ -31,6 +31,11 @@ void devprop_gpiochip_set_names(struct gpio_chip *chip)const char **names;int ret, i; +if (!chip->parent) { +dev_warn (&gdev->dev,"GPIO chip parent is NULL\n" ); +return ; + } + ret =device_property_read_string_array (chip->parent,"gpio-line-names" ,NULL ,0 );if (ret <0 )
Signature · 1 line
1.9.1
Quoted 6 lines · On Tue, Oct 25, 2016 at 6:31 PM, <[email protected]> wrote:
From: Thor Thayer <[email protected]>
Confirm the
chip->parentis valid before dereferencing because the parent parameter is optional.Signed-off-by Thor Thayer <[email protected]>
I wish it wasn't. Not much to do about though.
Patch applied.
Yours,
Linus Walleij