[patch] move dereference after null check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I moved the ops->inherits dereference below the null check.  I moved the 
other assignment as well so that they would be together.

Found by smatch static checker.

regards,
dan carpenter

Signed-off-by: Dan Carpenter <error27@xxxxxxxxx>

--- orig/drivers/ata/libata-core.c	2009-11-08 19:40:18.000000000 +0200
+++ devel/drivers/ata/libata-core.c	2009-11-08 19:42:06.000000000 +0200
@@ -5938,13 +5938,14 @@
 {
 	static DEFINE_SPINLOCK(lock);
 	const struct ata_port_operations *cur;
-	void **begin = (void **)ops;
-	void **end = (void **)&ops->inherits;
-	void **pp;
+	void **begin, **end, **pp;
 
 	if (!ops || !ops->inherits)
 		return;
 
+	begin = (void **)ops;
+	end = (void **)&ops->inherits;
+
 	spin_lock(&lock);
 
 	for (cur = ops->inherits; cur; cur = cur->inherits) {
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux