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:
parent
14386fd10c
commit
a2279ae5b5
2 changed files with 6 additions and 0 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue