From: Kiran Padwal Date: Thu, 5 Feb 2015 11:31:37 +0000 (+0530) Subject: ARCNET: Add missing error check for devm_kzalloc X-Git-Tag: v4.0-rc1~133^2~3^2~12 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=e8a308affcd79d95dad111f7872e43e9f73abb3b;p=karo-tx-linux.git ARCNET: Add missing error check for devm_kzalloc 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 Signed-off-by: David S. Miller --- diff --git a/drivers/net/arcnet/com20020-pci.c b/drivers/net/arcnet/com20020-pci.c index 6c99ff0b0bdd..945f532078e9 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;