git: cb91dc50950f - main - atomic: Fix the cast in the atomic_load_consume() interceptor

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Wed, 28 Aug 2024 19:31:15 UTC
The branch main has been updated by markj:

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

commit cb91dc50950ffdfd49337e844e231b69b8b5c634
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-08-28 19:25:11 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-08-28 19:31:03 +0000

    atomic: Fix the cast in the atomic_load_consume() interceptor
    
    As in commit c7a7e997d25d0, we should permit loading from a pointer to
    uintptr_t.
    
    Note that the other atomic_*_ptr() interfaces currently require casting
    regardless, only those defined in atomic_common.h try to be generic.
    
    Reported by:    jrtc27
    MFC after:      1 week
---
 sys/sys/atomic_san.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/sys/atomic_san.h b/sys/sys/atomic_san.h
index ef81b4b7c51e..e22324b87623 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)					\
-	((void *)atomic_load_acq_ptr((volatile uintptr_t *)(x)))
+	((__typeof(*x))atomic_load_acq_ptr((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)