]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ARCNET: Add missing error check for devm_kzalloc
authorKiran Padwal <kiran.padwal@smartplayin.com>
Thu, 5 Feb 2015 11:31:37 +0000 (17:01 +0530)
committerDavid S. Miller <davem@davemloft.net>
Thu, 5 Feb 2015 23:53:34 +0000 (15:53 -0800)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/arcnet/com20020-pci.c

index 6c99ff0b0bdd3443fcd13bac63aea44e09f33a62..945f532078e97d15b42ea9a5f5163e3ccc53a6c7 100644 (file)
@@ -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;