提交 a2279ae5 编写于 作者: R Roel Kluin 提交者: 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: NRoel Kluin <roel.kluin@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 14386fd1
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册