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


Groups > linux.kernel > #1263356 > unrolled thread

[PATCH] gpio: syscon: fix a possible NULL dereference

Started byLABBE Corentin <clabbe.montjoie@gmail.com>
First post2015-11-05 17:10 +0100
Last post2015-11-09 01:30 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] gpio: syscon: fix a possible NULL dereference LABBE Corentin <clabbe.montjoie@gmail.com> - 2015-11-05 17:10 +0100
    Re: [PATCH] gpio: syscon: fix a possible NULL dereference Alexandre Courbot <gnurou@gmail.com> - 2015-11-09 01:30 +0100

#1263356 — [PATCH] gpio: syscon: fix a possible NULL dereference

FromLABBE Corentin <clabbe.montjoie@gmail.com>
Date2015-11-05 17:10 +0100
Subject[PATCH] gpio: syscon: fix a possible NULL dereference
Message-ID<qrvgR-tj-17@gated-at.bofh.it>
of_match_device could return NULL, and so cause a NULL pointer
dereference later at line 199:
priv->flags = of_id->data;

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

diff --git a/drivers/gpio/gpio-syscon.c b/drivers/gpio/gpio-syscon.c
index 045a952..e673c58 100644
--- a/drivers/gpio/gpio-syscon.c
+++ b/drivers/gpio/gpio-syscon.c
@@ -192,6 +192,9 @@ static int syscon_gpio_probe(struct platform_device *pdev)
 	struct device_node *np = dev->of_node;
 	int ret;
 
+	if (!of_id)
+		return -ENODEV;
+
 	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
 	if (!priv)
 		return -ENOMEM;
-- 
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/

[toc] | [next] | [standalone]


#1265260

FromAlexandre Courbot <gnurou@gmail.com>
Date2015-11-09 01:30 +0100
Message-ID<qsIvo-7n4-9@gated-at.bofh.it>
In reply to#1263356
On Fri, Nov 6, 2015 at 1:02 AM, LABBE Corentin
<clabbe.montjoie@gmail.com> wrote:
> of_match_device could return NULL, and so cause a NULL pointer
> dereference later at line 199:
> priv->flags = of_id->data;
>
> Reported-by: coverity (CID 1324140)
> Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>

Same (optional) suggestion as the 74xx-mmio patch.

Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
--
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/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web