Skip to contentSkip to conversation

: Fix possible NULL pointer derefrence

PATCH In review Manjeet Pawar 2 participants 2 messages May 28, 2015 – Jun 1, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : Fix possible NULL pointer derefrence

From: Manjeet Pawar <[email protected]>
Subject: [PATCH] testcases/kernel/device-drivers/usb/tusb/tusb.c: Fix possible NULL pointer derefrence

pdev was accessed before its NULL check, this patch fixes this.

---
 testcases/kernel/device-drivers/usb/tusb/tusb.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
testcases/kernel/device-drivers/usb/tusb/tusb.c +3 -2
index 774600a..258070a 100644
@@ -386,14 +386,15 @@ static int test_hcd_probe()
 	int rc;
 	struct usb_hcd *hcd = NULL;
 	struct pci_dev *pdev = ltp_usb.pdev;
-	struct pci_device_id *id =
-	    (struct pci_device_id *)pdev->driver->id_table;
+	struct pci_device_id *id = NULL;
 
 	if (!pdev) {
 		printk("tusb: pdev pointer not set\n");
 		return 1;
 	}
 
+	id = (struct pci_device_id *)pdev->driver->id_table;
+
 	if (!id || !id->driver_data) {
 		printk("tusb: id_table not set\n");
 		return 1;
Signature · 8 lines
1.7.9.5


------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#1 lore raw

Hi!
Pushed, thanks.

Signature · 8 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list