Skip to content

Commit

Permalink
Staging: comedi: addi-data: NULL dereference of amcc in v_pci_card_li…
Browse files Browse the repository at this point in the history
…st_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>
  • Loading branch information
Roel Kluin authored and Greg Kroah-Hartman committed Sep 15, 2009
1 parent 14386fd commit a2279ae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions drivers/staging/comedi/drivers/addi-data/amcc_s5933_58.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a2279ae

Please sign in to comment.