Author: Serge Belyshev <[EMAIL PROTECTED]>
AuthorDate: Thu Oct 4 23:10:04 2007 +0200
Committer: Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Fri Oct 5 08:04:35 2007 -0700
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 126.96.36.199 paragraph 4 and
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
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 <[EMAIL PROTECTED]>
Signed-off-by: Andi Kleen <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
include/asm-x86_64/processor.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h
index 1952517..31f579b 100644
@@ -371,7 +371,7 @@ static inline void sync_core(void)
static inline void prefetch(void *x)
- asm volatile("prefetcht0 %0" :: "m" (*(unsigned long *)x));
+ asm volatile("prefetcht0 (%0)" :: "r" (x));
#define ARCH_HAS_PREFETCHW 1
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html