Skip to contentSkip to conversation

Fix warning in prefetch_range

PATCH In review Brian Gerst 2 participants 3 messages Apr 24, 2004 – Apr 26, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix warning in prefetch_range

Fix this warning:
include/linux/prefetch.h: In function `prefetch_range':
include/linux/prefetch.h:62: warning: pointer of type `void *' used in arithmetic

--
Brian Gerst

include/linux/prefetch.h +1 -1
diff -urN linux-2.6.5-rc1-bk/include/linux/prefetch.h linux/include/linux/prefetch.h
@@ -59,7 +59,7 @@
 {
 #ifdef ARCH_HAS_PREFETCH
 	char *cp;
-	char *end = addr + len;
+	char *end = (char *)addr + len;
 
 	for (cp = addr; cp < end; cp += PREFETCH_STRIDE)
 		prefetch(cp);
#1 lore raw
Quoted 6 lines · Brian Gerst

Fix this warning:
include/linux/prefetch.h: In function `prefetch_range':
include/linux/prefetch.h:62: warning: pointer of type `void *' used in arithmetic

eh? That's a gcc extension which has worked silently since forever.

What compiler version is generating the warning?

#2 lore raw
Quoted 8 lines · Andrew Morton
Quoted 4 lines · Brian Gerst

Fix this warning:
include/linux/prefetch.h: In function `prefetch_range':
include/linux/prefetch.h:62: warning: pointer of type `void *' used in arithmetic

Quoted 4 lines

eh? That's a gcc extension which has worked silently since forever.

What compiler version is generating the warning?

gcc (GCC) 3.3.3 20040412 (Red Hat Linux 3.3.3-7)

I saw the warning when compiling the nvidia driver, which uses -Wpointer-arith. I'll drop that switch instead.

--
Brian Gerst