Commit a2279ae5 authored by Roel Kluin's avatar Roel Kluin Committed by Greg Kroah-Hartman

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: default avatarRoel Kluin <roel.kluin@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 14386fd1
...@@ -261,6 +261,9 @@ void v_pci_card_list_init(unsigned short pci_vendor, char display) ...@@ -261,6 +261,9 @@ void v_pci_card_list_init(unsigned short pci_vendor, char display)
pci_vendor = i_ADDIDATADeviceID[i_Count]; pci_vendor = i_ADDIDATADeviceID[i_Count];
if (pcidev->vendor == pci_vendor) { if (pcidev->vendor == pci_vendor) {
amcc = kmalloc(sizeof(*amcc), GFP_KERNEL); amcc = kmalloc(sizeof(*amcc), GFP_KERNEL);
if (amcc == NULL)
continue;
memset(amcc, 0, sizeof(*amcc)); memset(amcc, 0, sizeof(*amcc));
amcc->pcidev = pcidev; amcc->pcidev = pcidev;
......
...@@ -254,6 +254,9 @@ void v_pci_card_list_init(unsigned short pci_vendor, char display) ...@@ -254,6 +254,9 @@ void v_pci_card_list_init(unsigned short pci_vendor, char display)
pci_for_each_dev(pcidev) { pci_for_each_dev(pcidev) {
if (pcidev->vendor == pci_vendor) { if (pcidev->vendor == pci_vendor) {
amcc = kmalloc(sizeof(*amcc), GFP_KERNEL); amcc = kmalloc(sizeof(*amcc), GFP_KERNEL);
if (amcc == NULL)
continue;
memset(amcc, 0, sizeof(*amcc)); memset(amcc, 0, sizeof(*amcc));
amcc->pcidev = pcidev; amcc->pcidev = pcidev;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment