]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
arm64: sysreg: Fix unprotected macro argmuent in write_sysreg
authorDave Martin <Dave.Martin@arm.com>
Tue, 25 Jul 2017 11:52:41 +0000 (12:52 +0100)
committerWill Deacon <will.deacon@arm.com>
Wed, 26 Jul 2017 08:28:18 +0000 (09:28 +0100)
write_sysreg() may misparse the value argument because it is used
without parentheses to protect it.

This patch adds the ( ) in order to avoid any surprises.

Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Dave Martin <Dave.Martin@arm.com>
[will: same change to write_sysreg_s]
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/include/asm/sysreg.h

index 16e44fa9b3b61b0bec9cc8ed92874310cd094176..248339e4aaf5a7a0b6bc09bc2184654bbda72845 100644 (file)
@@ -492,7 +492,7 @@ asm(
  * the "%x0" template means XZR.
  */
 #define write_sysreg(v, r) do {                                        \
-       u64 __val = (u64)v;                                     \
+       u64 __val = (u64)(v);                                   \
        asm volatile("msr " __stringify(r) ", %x0"              \
                     : : "rZ" (__val));                         \
 } while (0)
@@ -508,7 +508,7 @@ asm(
 })
 
 #define write_sysreg_s(v, r) do {                                      \
-       u64 __val = (u64)v;                                             \
+       u64 __val = (u64)(v);                                           \
        asm volatile("msr_s " __stringify(r) ", %x0" : : "rZ" (__val)); \
 } while (0)