amcc allocation may fail, prevent a NULL dereference.
allocation may fail, prevent a dereference.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
pci_vendor = i_ADDIDATADeviceID[i_Count];
if (pcidev->vendor == pci_vendor) {
amcc = kmalloc(sizeof(*amcc), GFP_KERNEL);
+ if (amcc == NULL)
+ continue;
+
memset(amcc, 0, sizeof(*amcc));
amcc->pcidev = pcidev;
pci_for_each_dev(pcidev) {
if (pcidev->vendor == pci_vendor) {
amcc = kmalloc(sizeof(*amcc), GFP_KERNEL);
+ if (amcc == NULL)
+ continue;
+
memset(amcc, 0, sizeof(*amcc));
amcc->pcidev = pcidev;