LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] ARCNET: Add missing error check for devm_kzalloc
@ 2015-02-05 11:31 Kiran Padwal
  2015-02-05 23:53 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Kiran Padwal @ 2015-02-05 11:31 UTC (permalink / raw)
  To: David S. Miller
  Cc: Michael Grzeschik, netdev, linux-kernel, Kiran Padwal, Kiran Padwal

This patch add a missing check on the return value of devm_kzalloc,
which would cause a NULL pointer dereference in a OOM situation.

Signed-off-by: Kiran Padwal <kiran.padwal@smartplayin.com>
---
 drivers/net/arcnet/com20020-pci.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c
index 6c99ff0..945f532 100644
--- a/drivers/net/arcnet/com20020-pci.c
+++ b/drivers/net/arcnet/com20020-pci.c
@@ -78,6 +78,9 @@ static int com20020pci_probe(struct pci_dev *pdev, const struct pci_device_id *i
 
 	priv = devm_kzalloc(&pdev->dev, sizeof(struct com20020_priv),
 			    GFP_KERNEL);
+	if (!priv)
+		return -ENOMEM;
+
 	ci = (struct com20020_pci_card_info *)id->driver_data;
 	priv->ci = ci;
 
-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ARCNET: Add missing error check for devm_kzalloc
  2015-02-05 11:31 [PATCH] ARCNET: Add missing error check for devm_kzalloc Kiran Padwal
@ 2015-02-05 23:53 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-02-05 23:53 UTC (permalink / raw)
  To: kiran.padwal; +Cc: m.grzeschik, netdev, linux-kernel, kiran.padwal21

From: Kiran Padwal <kiran.padwal@smartplayin.com>
Date: Thu,  5 Feb 2015 17:01:37 +0530

> This patch add a missing check on the return value of devm_kzalloc,
> which would cause a NULL pointer dereference in a OOM situation.
> 
> Signed-off-by: Kiran Padwal <kiran.padwal@smartplayin.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-02-05 23:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-05 11:31 [PATCH] ARCNET: Add missing error check for devm_kzalloc Kiran Padwal
2015-02-05 23:53 ` David Miller

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).