[PATCH 04/11] UBUNTU: SAUCE: (drop after 2.6.39) staging: rts_pstor: potential NULL dereference

Keng-Yu Lin keng-yu.lin at canonical.com
Thu Mar 31 03:51:06 UTC 2011


From: Vasiliy Kulikov <segoon at openwall.com>

pci_get_bus_and_slot() may return NULL, but the caller checks
wrong variable.

Signed-off-by: Vasiliy Kulikov <segoon at openwall.com>
Signed-off-by: Greg Kroah-Hartman <gregkh at suse.de>

BugLink: http://bugs.launchpad.net/bugs/698006
(cherry picked from commit 37af07d19a53924a70ae42faebf968c04a631c8c)

Signed-off-by: Keng-Yu Lin <keng-yu.lin at canonical.com>
---
 drivers/staging/rts_pstor/rtsx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/rts_pstor/rtsx.c b/drivers/staging/rts_pstor/rtsx.c
index 9864b1a..2b18379 100644
--- a/drivers/staging/rts_pstor/rtsx.c
+++ b/drivers/staging/rts_pstor/rtsx.c
@@ -334,7 +334,7 @@ int rtsx_read_pci_cfg_byte(u8 bus, u8 dev, u8 func, u8 offset, u8 *val)
 	u8 devfn = (dev << 3) | func;
 
 	pdev = pci_get_bus_and_slot(bus, devfn);
-	if (!dev)
+	if (!pdev)
 		return -1;
 
 	pci_read_config_byte(pdev, offset, &data);
-- 
1.7.1





More information about the kernel-team mailing list