[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240104094010.394669-1-stuart.menefy@codasip.com>
Date: Thu, 4 Jan 2024 09:40:10 +0000
From: Stuart Menefy <stuart.menefy@...asip.com>
To: Arnd Bergmann <arnd@...db.de>,
linux-kernel@...r.kernel.org
Cc: linux-arch@...r.kernel.org,
David McKay <david.mckay@...asip.com>
Subject: [PATCH] asm-generic: Fix 32 bit __generic_cmpxchg_local
From: David McKay <david.mckay@...asip.com>
Commit 656e9007ef58 ("asm-generic: avoid __generic_cmpxchg_local
warnings") introduced a typo that means the code is incorrect for 32 bit
values. It will work fine for postive numbers, but will fail for
negative numbers on a system where longs are 64 bit.
Fixes: 656e9007ef58 ("asm-generic: avoid __generic_cmpxchg_local warnings")
Signed-off-by: David McKay <david.mckay@...asip.com>
Signed-off-by: Stuart Menefy <stuart.menefy@...asip.com>
---
include/asm-generic/cmpxchg-local.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/asm-generic/cmpxchg-local.h b/include/asm-generic/cmpxchg-local.h
index 3df9f59a544e..f27d66fdc00a 100644
--- a/include/asm-generic/cmpxchg-local.h
+++ b/include/asm-generic/cmpxchg-local.h
@@ -34,7 +34,7 @@ static inline unsigned long __generic_cmpxchg_local(volatile void *ptr,
*(u16 *)ptr = (new & 0xffffu);
break;
case 4: prev = *(u32 *)ptr;
- if (prev == (old & 0xffffffffffu))
+ if (prev == (old & 0xffffffffu))
*(u32 *)ptr = (new & 0xffffffffu);
break;
case 8: prev = *(u64 *)ptr;
--
2.39.3
Powered by blists - more mailing lists