* [PATCH] gpio: gpiolib-devprop: Check chip->parent pointer before dereferencing
@ 2016-10-25 16:31 tthayer
2016-10-25 18:24 ` Linus Walleij
0 siblings, 1 reply; 2+ messages in thread
From: tthayer @ 2016-10-25 16:31 UTC (permalink / raw)
To: linus.walleij, gnurou, mika.westerberg; +Cc: linux-gpio, linux-kernel, tthayer
From: Thor Thayer <tthayer@opensource.altera.com>
Confirm the chip->parent is valid before dereferencing because
the parent parameter is optional.
Signed-off-by: Thor Thayer <tthayer@opensource.altera.com>
---
drivers/gpio/gpiolib-devprop.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/gpio/gpiolib-devprop.c b/drivers/gpio/gpiolib-devprop.c
index 17bfc41..27f383b 100644
--- a/drivers/gpio/gpiolib-devprop.c
+++ b/drivers/gpio/gpiolib-devprop.c
@@ -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)
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] gpio: gpiolib-devprop: Check chip->parent pointer before dereferencing
2016-10-25 16:31 [PATCH] gpio: gpiolib-devprop: Check chip->parent pointer before dereferencing tthayer
@ 2016-10-25 18:24 ` Linus Walleij
0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2016-10-25 18:24 UTC (permalink / raw)
To: Thor Thayer; +Cc: Alexandre Courbot, Mika Westerberg, linux-gpio, linux-kernel
On Tue, Oct 25, 2016 at 6:31 PM, <tthayer@opensource.altera.com> wrote:
> From: Thor Thayer <tthayer@opensource.altera.com>
>
> Confirm the chip->parent is valid before dereferencing because
> the parent parameter is optional.
>
> Signed-off-by: Thor Thayer <tthayer@opensource.altera.com>
I wish it wasn't. Not much to do about though.
Patch applied.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-10-25 18:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-25 16:31 [PATCH] gpio: gpiolib-devprop: Check chip->parent pointer before dereferencing tthayer
2016-10-25 18:24 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).