Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Aug 2024 18:55:48 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: c7a7e997d25d - main - 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
Message-ID:  <202408281855.47SItml1024354@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by markj:

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

commit c7a7e997d25d0b33769252d002b16839c864c83d
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-08-28 18:51:06 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-08-28 18:55:39 +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
---
 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)))



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202408281855.47SItml1024354>