aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerge Belyshev <belyshev@depni.sinp.msu.ru>2007-10-04 17:10:04 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-05 11:04:35 -0400
commit4ecbca8554d0f643351ee07d3284138a5e85ba81 (patch)
tree06fd712d440bba74c7957736a9a804dd42e276a4
parent9cdcaa2c9330432bfe891d40f2d914b80bbcf9f3 (diff)
Remove unnecessary cast in prefetch()
It is ok to call prefetch() function with NULL argument, as specifically commented in include/linux/prefetch.h. But in standard C, it is invalid to dereference NULL pointer (see C99 standard 6.5.3.2 paragraph 4 and note #84). prefetch() has a memory reference for its argument. Newer gcc versions (4.3 and above) will use that to conclude that "x" argument is non-null and thus wreaking havok everywhere prefetch() was inlined. Fixed by removing cast and changing asm constraint. [ It seems in theory gcc 4.2 could miscompile this too; although no cases known. In 2.6.24 we should probably switch to __builtin_prefetch() instead, but this is a simpler fix for now. -- AK ] Signed-off-by: Serge Belyshev <belyshev@depni.sinp.msu.ru> Signed-off-by: Andi Kleen <ak@suse.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--include/asm-x86_64/processor.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h
index 19525175b91c..31f579b828f2 100644
--- a/include/asm-x86_64/processor.h
+++ b/include/asm-x86_64/processor.h
@@ -371,7 +371,7 @@ static inline void sync_core(void)
371#define ARCH_HAS_PREFETCH 371#define ARCH_HAS_PREFETCH
372static inline void prefetch(void *x) 372static inline void prefetch(void *x)
373{ 373{
374 asm volatile("prefetcht0 %0" :: "m" (*(unsigned long *)x)); 374 asm volatile("prefetcht0 (%0)" :: "r" (x));
375} 375}
376 376
377#define ARCH_HAS_PREFETCHW 1 377#define ARCH_HAS_PREFETCHW 1