Skip to contentSkip to conversation

Sparse 0.2 warnings from {asm,net}/checksum.h

PATCH New Tilman Schmidt 2 participants 3 messages Jan 1, 2007 – Jan 3, 2007

lore
Share & tools
lore
#0 lore raw

With sparse 0.2, my previously sparse-clean driver generates the following warnings:

include/asm/checksum.h:182:6: warning: symbol 'sum' shadows an earlier one include/asm/checksum.h:178:28: originally declared here include/net/checksum.h:33:6: warning: symbol 'sum' shadows an earlier one include/net/checksum.h:31:27: originally declared here

Architecture is i386. The lines referred to are in the functions csum_and_copy_to_user() and csum_and_copy_from_user(), but I don't see why sparse would emit such a warning for that code.

Any chance of getting rid of these?

Thanks
Tilman

Signature · 4 lines
Tilman Schmidt                          E-Mail: [email protected]
Bonn, Germany
Diese Nachricht besteht zu 100% aus wiederverwerteten Bits.
Ungeöffnet mindestens haltbar bis: (siehe Rückseite)
#1 lore raw
Quoted 11 lines · Tilman Schmidt

With sparse 0.2, my previously sparse-clean driver generates the following warnings:

include/asm/checksum.h:182:6: warning: symbol 'sum' shadows an earlier one include/asm/checksum.h:178:28: originally declared here include/net/checksum.h:33:6: warning: symbol 'sum' shadows an earlier one include/net/checksum.h:31:27: originally declared here

Architecture is i386. The lines referred to are in the functions csum_and_copy_to_user() and csum_and_copy_from_user(), but I don't see why sparse would emit such a warning for that code.

It's complaining about the 'sum' declaration in __range_not_ok used by access_ok(), which shadows the variable declared in the prototype of the functions you mention.

Dave

Signature · 1 line
http://www.codemonkey.org.uk
#2 lore raw

PATCH 1/1 fix sparse warnings from {asm,net}/checksum.h

Rename the variable "sum" in the __range_ok macros to avoid name collisions causing lots of "symbol shadows an earlier one" warnings by sparse.

---

 asm-arm/uaccess.h       |    4 ++--
 asm-arm26/uaccess-asm.h |    4 ++--
 asm-i386/uaccess.h      |    4 ++--
 asm-m32r/uaccess.h      |    4 ++--
 asm-x86_64/uaccess.h    |    4 ++--
 5 files changed, 10 insertions(+), 10 deletions(-)
include/asm-arm/uaccess.h +2 -2
diff -pru linux-2.6.20-rc3-work/include/asm-arm/uaccess.h linux-2.6.20-rc3-new/include/asm-arm/uaccess.h
@@ -76,10 +76,10 @@ static inline void set_fs(mm_segment_t f
 
 /* We use 33-bit arithmetic here... */
 #define __range_ok(addr,size) ({ \
-	unsigned long flag, sum; \
+	unsigned long flag, roksum; \
 	__chk_user_ptr(addr);	\
 	__asm__("adds %1, %2, %3; sbcccs %1, %1, %0; movcc %0, #0" \
-		: "=&r" (flag), "=&r" (sum) \
+		: "=&r" (flag), "=&r" (roksum) \
 		: "r" (addr), "Ir" (size), "0" (current_thread_info()->addr_limit) \
 		: "cc"); \
 	flag; })
include/asm-arm26/uaccess-asm.h +2 -2
diff -pru linux-2.6.20-rc3-work/include/asm-arm26/uaccess-asm.h linux-2.6.20-rc3-new/include/asm-arm26/uaccess-asm.h
@@ -34,9 +34,9 @@ static inline void set_fs (mm_segment_t 
 }
 
 #define __range_ok(addr,size) ({					\
-	unsigned long flag, sum;					\
+	unsigned long flag, roksum;					\
 	__asm__ __volatile__("subs %1, %0, %3; cmpcs %1, %2; movcs %0, #0" \
-		: "=&r" (flag), "=&r" (sum)				\
+		: "=&r" (flag), "=&r" (roksum)				\
 		: "r" (addr), "Ir" (size), "0" (current_thread_info()->addr_limit)	\
 		: "cc");						\
 	flag; })
include/asm-i386/uaccess.h +2 -2
diff -pru linux-2.6.20-rc3-work/include/asm-i386/uaccess.h linux-2.6.20-rc3-new/include/asm-i386/uaccess.h
@@ -54,10 +54,10 @@ extern struct movsl_mask {
  * This needs 33-bit arithmetic. We have a carry...
  */
 #define __range_ok(addr,size) ({ \
-	unsigned long flag,sum; \
+	unsigned long flag,roksum; \
 	__chk_user_ptr(addr); \
 	asm("addl %3,%1 ; sbbl %0,%0; cmpl %1,%4; sbbl $0,%0" \
-		:"=&r" (flag), "=r" (sum) \
+		:"=&r" (flag), "=r" (roksum) \
 		:"1" (addr),"g" ((int)(size)),"rm" (current_thread_info()->addr_limit.seg)); \
 	flag; })
 
include/asm-m32r/uaccess.h +2 -2
diff -pru linux-2.6.20-rc3-work/include/asm-m32r/uaccess.h linux-2.6.20-rc3-new/include/asm-m32r/uaccess.h
@@ -68,7 +68,7 @@ static inline void set_fs(mm_segment_t s
  * This needs 33-bit arithmetic. We have a carry...
  */
 #define __range_ok(addr,size) ({					\
-	unsigned long flag, sum; 					\
+	unsigned long flag, roksum; 					\
 	__chk_user_ptr(addr);						\
 	asm ( 								\
 		"	cmpu	%1, %1    ; clear cbit\n"		\
@@ -76,7 +76,7 @@ static inline void set_fs(mm_segment_t s
 		"	subx	%0, %0\n"				\
 		"	cmpu	%4, %1\n"				\
 		"	subx	%0, %5\n"				\
-		: "=&r" (flag), "=r" (sum)				\
+		: "=&r" (flag), "=r" (roksum)				\
 		: "1" (addr), "r" ((int)(size)), 			\
 		  "r" (current_thread_info()->addr_limit.seg), "r" (0)	\
 		: "cbit" );						\
include/asm-x86_64/uaccess.h +2 -2
diff -pru linux-2.6.20-rc3-work/include/asm-x86_64/uaccess.h linux-2.6.20-rc3-new/include/asm-x86_64/uaccess.h
@@ -37,11 +37,11 @@
  * Uhhuh, this needs 65-bit arithmetic. We have a carry..
  */
 #define __range_not_ok(addr,size) ({ \
-	unsigned long flag,sum; \
+	unsigned long flag,roksum; \
 	__chk_user_ptr(addr); \
 	asm("# range_ok\n\r" \
 		"addq %3,%1 ; sbbq %0,%0 ; cmpq %1,%4 ; sbbq $0,%0"  \
-		:"=&r" (flag), "=r" (sum) \
+		:"=&r" (flag), "=r" (roksum) \
 		:"1" (addr),"g" ((long)(size)),"g" (current_thread_info()->addr_limit.seg)); \
 	flag; })