Skip to contentSkip to conversation

x86: platform: olpc: fix potential NULL pointer dereference

PATCH In review Vasiliy Kulikov 1 participant 1 message Nov 18, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/4 x86: platform: olpc: fix potential NULL pointer dereference

pdev is never NULL here, instead we should check pcidev as it is returned from pci_get_device() and may be NULL. This code dereferences NULL in pci_enable_device_io() call.

---
Compile tested.

 arch/x86/platform/olpc/olpc-xo1.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/platform/olpc/olpc-xo1.c +1 -1
index f5442c0..c35d03a 100644
@@ -94,7 +94,7 @@ static int __devinit olpc_xo1_probe(struct platform_device *pdev)
 
 	pcidev = pci_get_device(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_ISA,
 				NULL);
-	if (!pdev)
+	if (!pcidev)
 		return -ENODEV;
 
 	r = setup_bases(pcidev);
Signature · 1 line
1.7.0.4