Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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;
+3 −0
Original line number Diff line number Diff line
@@ -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;