Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757278AbbBELdd (ORCPT ); Thu, 5 Feb 2015 06:33:33 -0500 Received: from smtp97.ord1c.emailsrvr.com ([108.166.43.97]:43983 "EHLO smtp97.ord1c.emailsrvr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752436AbbBELdc (ORCPT ); Thu, 5 Feb 2015 06:33:32 -0500 X-Sender-Id: kiran.padwal@smartplayin.com From: Kiran Padwal To: "David S. Miller" Cc: Michael Grzeschik , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Kiran Padwal , Kiran Padwal Subject: [PATCH] ARCNET: Add missing error check for devm_kzalloc Date: Thu, 5 Feb 2015 17:01:37 +0530 Message-Id: <1423135897-20448-1-git-send-email-kiran.padwal@smartplayin.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1024 Lines: 30 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 --- 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 -- 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/