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 <kiran.padwal@smartplayin.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
7744b5f369
commit
e8a308affc
1 changed files with 3 additions and 0 deletions
|
@ -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),
|
priv = devm_kzalloc(&pdev->dev, sizeof(struct com20020_priv),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
|
if (!priv)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
ci = (struct com20020_pci_card_info *)id->driver_data;
|
ci = (struct com20020_pci_card_info *)id->driver_data;
|
||||||
priv->ci = ci;
|
priv->ci = ci;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue