dect
/
linux-2.6
Archived
13
0
Fork 0

Staging: comedi: addi-data: NULL dereference of amcc in v_pci_card_list_init()

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>
This commit is contained in:
Roel Kluin 2009-08-31 10:54:37 +02:00 committed by Greg Kroah-Hartman
parent 14386fd10c
commit a2279ae5b5
2 changed files with 6 additions and 0 deletions

View 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;

View 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;