Staging: comedi: addi-data: NULL dereference of amcc in v_pci_card_list_init()
authorRoel Kluin <roel.kluin@gmail.com>
Mon, 31 Aug 2009 08:54:37 +0000 (10:54 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 15 Sep 2009 19:02:34 +0000 (12:02 -0700)
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>
drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h
drivers/staging/comedi/drivers/addi-data/amcc_s5933_58.h

index d288289143eaf66c172f19ae1f0884e0ad5dfae3..f96b1289cdfc72e292dbc07fd10dcf6c358f2b0f 100644 (file)
@@ -261,6 +261,9 @@ void v_pci_card_list_init(unsigned short pci_vendor, char display)
                        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;
index b76f877f250ac08e4bc4a6ed17a2a5fb18df5ff4..49141b3558e1c86cce425e08ea860987db3a7a2a 100644 (file)
@@ -254,6 +254,9 @@ void v_pci_card_list_init(unsigned short pci_vendor, char display)
        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;