Skip to content

Commit d0153c7

Browse files
Dave Martinwildea01
authored andcommitted
arm64: sysreg: Fix unprotected macro argmuent in write_sysreg
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 <[email protected]> Signed-off-by: Dave Martin <[email protected]> [will: same change to write_sysreg_s] Signed-off-by: Will Deacon <[email protected]>
1 parent 6c17c1c commit d0153c7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/arm64/include/asm/sysreg.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ asm(
492492
* the "%x0" template means XZR.
493493
*/
494494
#define write_sysreg(v, r) do { \
495-
u64 __val = (u64)v; \
495+
u64 __val = (u64)(v); \
496496
asm volatile("msr " __stringify(r) ", %x0" \
497497
: : "rZ" (__val)); \
498498
} while (0)
@@ -508,7 +508,7 @@ asm(
508508
})
509509

510510
#define write_sysreg_s(v, r) do { \
511-
u64 __val = (u64)v; \
511+
u64 __val = (u64)(v); \
512512
asm volatile("msr_s " __stringify(r) ", %x0" : : "rZ" (__val)); \
513513
} while (0)
514514

0 commit comments

Comments
 (0)