git: 1e999a3ae1ac - stable/14 - atomic: Avoid casting the return value of atomic_load_ptr to void HEAD branches config description git-daemon-export-ok gl-conf hooks info objects packed-refs refs

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Thu, 05 Sep 2024 13:46:14 UTC
The branch stable/14 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=1e999a3ae1aceaaf84add14461243afe8ff45e39

commit 1e999a3ae1aceaaf84add14461243afe8ff45e39
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-08-28 18:51:06 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-09-05 13:44:00 +0000

    atomic: Avoid casting the return value of atomic_load_ptr to void *
    
    Otherwise a cast is needed to load a uintptr_t value.
    
    Fixes:  e1f4d623779d ("rangelocks: remove unneeded cast of the atomic_load_ptr() result")
    MFC after:      1 week
    
    (cherry picked from commit c7a7e997d25d0b33769252d002b16839c864c83d)
---
 sys/sys/atomic_san.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/sys/atomic_san.h b/sys/sys/atomic_san.h
index eb6913296a45..ef81b4b7c51e 100644
--- a/sys/sys/atomic_san.h
+++ b/sys/sys/atomic_san.h
@@ -266,7 +266,8 @@ ATOMIC_SAN_THREAD_FENCE(SAN_INTERCEPTOR_PREFIX);
 #define	atomic_fcmpset_rel_ptr		ATOMIC_SAN(fcmpset_rel_ptr)
 #define	atomic_fetchadd_ptr		ATOMIC_SAN(fetchadd_ptr)
 #define	atomic_load_ptr(x)						\
-	((void *)ATOMIC_SAN(load_ptr)(__DECONST(volatile uintptr_t *, (x))))
+	((__typeof(*x))ATOMIC_SAN(load_ptr)(				\
+	    __DECONST(volatile uintptr_t *, (x))))
 #define	atomic_load_acq_ptr		ATOMIC_SAN(load_acq_ptr)
 #define	atomic_load_consume_ptr(x)					\
 	((void *)atomic_load_acq_ptr((volatile uintptr_t *)(x)))