Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1267432

[PATCH 3/3] gpio: palmas: fix a possible NULL dereference

From LABBE Corentin <clabbe.montjoie@gmail.com>
Newsgroups linux.kernel
Subject [PATCH 3/3] gpio: palmas: fix a possible NULL dereference
Date 2015-11-11 21:30 +0100
Message-ID <qtKbM-7AZ-27@gated-at.bofh.it> (permalink)
References <qtKbL-7AZ-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


of_match_device could return NULL, and so cause a NULL pointer
dereference later.

Reported-by: coverity (CID 1130700)
Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
---
 drivers/gpio/gpio-palmas.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpio/gpio-palmas.c b/drivers/gpio/gpio-palmas.c
index 171a638..52b447c 100644
--- a/drivers/gpio/gpio-palmas.c
+++ b/drivers/gpio/gpio-palmas.c
@@ -167,6 +167,8 @@ static int palmas_gpio_probe(struct platform_device *pdev)
 	const struct palmas_device_data *dev_data;
 
 	match = of_match_device(of_palmas_gpio_match, &pdev->dev);
+	if (!match)
+		return -ENODEV;
 	dev_data = match->data;
 	if (!dev_data)
 		dev_data = &palmas_dev_data;
-- 
2.4.10

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 1/3] gpio: 74xx: fix a possible NULL dereference LABBE Corentin <clabbe.montjoie@gmail.com> - 2015-11-11 21:30 +0100
  [PATCH 2/3] gpio: syscon: fix a possible NULL dereference LABBE Corentin <clabbe.montjoie@gmail.com> - 2015-11-11 21:30 +0100
  [PATCH 3/3] gpio: palmas: fix a possible NULL dereference LABBE Corentin <clabbe.montjoie@gmail.com> - 2015-11-11 21:30 +0100

csiph-web