linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Protect prefetch macro arguments.
@ 2010-03-26 20:44 David Daney
  2010-03-26 21:04 ` Linus Torvalds
  0 siblings, 1 reply; 4+ messages in thread
From: David Daney @ 2010-03-26 20:44 UTC (permalink / raw)
  To: torvalds, akpm; +Cc: linux-kernel, linux-arch, David Daney

The GCC built-in __builtin_prefetch() is a vargs function.  If we
don't wrap the macro parameter in parentheses, a comma operator in the
actual argument list might cause unintended parameters to be passed to
__builtin_prefetch().

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
---
 include/linux/prefetch.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/prefetch.h b/include/linux/prefetch.h
index af7c36a..6179433 100644
--- a/include/linux/prefetch.h
+++ b/include/linux/prefetch.h
@@ -35,11 +35,11 @@
 */
 
 #ifndef ARCH_HAS_PREFETCH
-#define prefetch(x) __builtin_prefetch(x)
+#define prefetch(x) __builtin_prefetch((x))
 #endif
 
 #ifndef ARCH_HAS_PREFETCHW
-#define prefetchw(x) __builtin_prefetch(x,1)
+#define prefetchw(x) __builtin_prefetch((x), 1)
 #endif
 
 #ifndef ARCH_HAS_SPINLOCK_PREFETCH
-- 
1.6.6.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-03-26 21:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-26 20:44 [PATCH] Protect prefetch macro arguments David Daney
2010-03-26 21:04 ` Linus Torvalds
2010-03-26 21:18   ` David Daney
2010-03-26 21:23     ` Linus Torvalds

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).