[PATCH] Protect prefetch macro arguments.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-arch" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux