public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bit_spinlock: Fix the __bitlock() definition
@ 2026-05-02  1:55 Bart Van Assche
  2026-05-04  6:00 ` Marco Elver
  0 siblings, 1 reply; 2+ messages in thread
From: Bart Van Assche @ 2026-05-02  1:55 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: Marco Elver, linux-kernel, Bart Van Assche

Surround the bitnum argument with parentheses because it could be an
expression that includes an operator with a lower priority than the
addition operator, e.g. the exclusive or operator.

Fixes: eb7d96a13bf4 ("bit_spinlock: Support Clang's context analysis")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 include/linux/bit_spinlock.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/bit_spinlock.h b/include/linux/bit_spinlock.h
index 7869a6e59b6a..bcae36b9a739 100644
--- a/include/linux/bit_spinlock.h
+++ b/include/linux/bit_spinlock.h
@@ -17,7 +17,7 @@
  * static analysis can use.
  */
 context_lock_struct(__context_bitlock) { };
-#define __bitlock(bitnum, addr) (struct __context_bitlock *)(bitnum + (addr))
+#define __bitlock(bitnum, addr) (struct __context_bitlock *)((bitnum) + (addr))
 
 /*
  *  bit-based spin_lock()

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

end of thread, other threads:[~2026-05-04  6:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-02  1:55 [PATCH] bit_spinlock: Fix the __bitlock() definition Bart Van Assche
2026-05-04  6:00 ` Marco Elver

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox