diff mbox series

arm64: signal: Fix some under-bracketed UAPI macros

Message ID 20240729152005.289844-1-Dave.Martin@arm.com (mailing list archive)
State New, archived
Headers show
Series arm64: signal: Fix some under-bracketed UAPI macros | expand

Commit Message

Dave Martin July 29, 2024, 3:20 p.m. UTC
A few SME-related sigcontext UAPI macros leave an argument
unprotected from misparsing during macro expansion.

Add parentheses around references to macro arguments where
appropriate.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Fixes: ee072cf70804 ("arm64/sme: Implement signal handling for ZT")
Fixes: 39782210eb7e ("arm64/sme: Implement ZA signal handling")

---

Based on: v6.11-rc1

These were just spotted by inspection, but it seems a good idea to
sort them out anyway.  At worst, the change is harmless.

The way the macros are typically used (and the presumed lack of bug
reports) means that the chance of actually hitting these issues
appears low.

---
 arch/arm64/include/uapi/asm/sigcontext.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)


base-commit: 8400291e289ee6b2bf9779ff1c83a291501f017b

Comments

Mark Brown July 29, 2024, 3:36 p.m. UTC | #1
On Mon, Jul 29, 2024 at 04:20:05PM +0100, Dave Martin wrote:
> A few SME-related sigcontext UAPI macros leave an argument
> unprotected from misparsing during macro expansion.
> 
> Add parentheses around references to macro arguments where
> appropriate.

Reviewed-by: Mark Brown <broonie@kernel.org>
Will Deacon Aug. 16, 2024, 3:15 p.m. UTC | #2
On Mon, 29 Jul 2024 16:20:05 +0100, Dave Martin wrote:
> A few SME-related sigcontext UAPI macros leave an argument
> unprotected from misparsing during macro expansion.
> 
> Add parentheses around references to macro arguments where
> appropriate.
> 
> 
> [...]

Applied to arm64 (for-next/misc), thanks!

[1/1] arm64: signal: Fix some under-bracketed UAPI macros
      https://git.kernel.org/arm64/c/fc2220c9b158

Cheers,
diff mbox series

Patch

diff --git a/arch/arm64/include/uapi/asm/sigcontext.h b/arch/arm64/include/uapi/asm/sigcontext.h
index 8a45b7a411e0..57f76d82077e 100644
--- a/arch/arm64/include/uapi/asm/sigcontext.h
+++ b/arch/arm64/include/uapi/asm/sigcontext.h
@@ -320,10 +320,10 @@  struct zt_context {
 	((sizeof(struct za_context) + (__SVE_VQ_BYTES - 1))	\
 		/ __SVE_VQ_BYTES * __SVE_VQ_BYTES)
 
-#define ZA_SIG_REGS_SIZE(vq) ((vq * __SVE_VQ_BYTES) * (vq * __SVE_VQ_BYTES))
+#define ZA_SIG_REGS_SIZE(vq) (((vq) * __SVE_VQ_BYTES) * ((vq) * __SVE_VQ_BYTES))
 
 #define ZA_SIG_ZAV_OFFSET(vq, n) (ZA_SIG_REGS_OFFSET + \
-				  (SVE_SIG_ZREG_SIZE(vq) * n))
+				  (SVE_SIG_ZREG_SIZE(vq) * (n)))
 
 #define ZA_SIG_CONTEXT_SIZE(vq) \
 		(ZA_SIG_REGS_OFFSET + ZA_SIG_REGS_SIZE(vq))
@@ -334,7 +334,7 @@  struct zt_context {
 
 #define ZT_SIG_REGS_OFFSET sizeof(struct zt_context)
 
-#define ZT_SIG_REGS_SIZE(n) (ZT_SIG_REG_BYTES * n)
+#define ZT_SIG_REGS_SIZE(n) (ZT_SIG_REG_BYTES * (n))
 
 #define ZT_SIG_CONTEXT_SIZE(n) \
 	(sizeof(struct zt_context) + ZT_SIG_REGS_SIZE(n))