From: <tthayer@opensource.altera.com>
To: linus.walleij@linaro.org, gnurou@gmail.com,
mika.westerberg@linux.intel.com
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
tthayer@opensource.altera.com
Subject: [PATCH] gpio: gpiolib-devprop: Check chip->parent pointer before dereferencing
Date: Tue, 25 Oct 2016 11:31:23 -0500 [thread overview]
Message-ID: <1477413083-9159-1-git-send-email-tthayer@opensource.altera.com> (raw)
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
next reply other threads:[~2016-10-25 16:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-25 16:31 tthayer [this message]
2016-10-25 18:24 ` [PATCH] gpio: gpiolib-devprop: Check chip->parent pointer before dereferencing Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1477413083-9159-1-git-send-email-tthayer@opensource.altera.com \
--to=tthayer@opensource.altera.com \
--cc=gnurou@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).