git: 19f7b2bbc4e4 - stable/14 - atomics: atomic_load_consume_ptr(): Accept pointers to const
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 27 Jan 2025 18:20:27 UTC
The branch stable/14 has been updated by olce:
URL: https://cgit.FreeBSD.org/src/commit/?id=19f7b2bbc4e4fec33b7e8d546dd05a79533ca8e4
commit 19f7b2bbc4e4fec33b7e8d546dd05a79533ca8e4
Author: Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2025-01-20 13:53:35 +0000
Commit: Olivier Certner <olce@FreeBSD.org>
CommitDate: 2025-01-27 18:19:57 +0000
atomics: atomic_load_consume_ptr(): Accept pointers to const
Now that all directly-implemented loads (with acquire semantics or not)
accept pointers to const, ensure that atomic_load_consume_ptr(), built
on atomic_load_acq_ptr(), does so too, in the common atomics header as
well as *SAN interceptors.
Reviewed by: kib
Fixes: 5e9a82e898d5 ("atomics: Constify loads")
MFC after: 4 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48497
(cherry picked from commit 8dd436fca1149ec7e56f6f06abde50a2e8796ad6)
---
sys/sys/atomic_common.h | 2 +-
sys/sys/atomic_san.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sys/sys/atomic_common.h b/sys/sys/atomic_common.h
index e03cd93c2d4a..e802b2a99630 100644
--- a/sys/sys/atomic_common.h
+++ b/sys/sys/atomic_common.h
@@ -133,7 +133,7 @@
* openly resorting to the stronger acquire fence, to be sorted out.
*/
#define atomic_load_consume_ptr(p) \
- ((__typeof(*p)) atomic_load_acq_ptr((uintptr_t *)p))
+ ((__typeof(*p)) atomic_load_acq_ptr((const volatile uintptr_t *)p))
#define atomic_interrupt_fence() __compiler_membar()
diff --git a/sys/sys/atomic_san.h b/sys/sys/atomic_san.h
index 93a9bfcbf593..06c6c98ec8a8 100644
--- a/sys/sys/atomic_san.h
+++ b/sys/sys/atomic_san.h
@@ -270,7 +270,7 @@ ATOMIC_SAN_THREAD_FENCE(SAN_INTERCEPTOR_PREFIX);
__DECONST(volatile uintptr_t *, (x))))
#define atomic_load_acq_ptr ATOMIC_SAN(load_acq_ptr)
#define atomic_load_consume_ptr(x) \
- ((__typeof(*x))atomic_load_acq_ptr((volatile uintptr_t *)(x)))
+ ((__typeof(*x))atomic_load_acq_ptr((const volatile uintptr_t *)(x)))
#define atomic_readandclear_ptr ATOMIC_SAN(readandclear_ptr)
#define atomic_set_ptr ATOMIC_SAN(set_ptr)
#define atomic_set_acq_ptr ATOMIC_SAN(set_acq_ptr)