Re: 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

From: Mark Johnston <markj_at_freebsd.org>
Date: Wed, 28 Aug 2024 19:31:47 UTC
On Wed, Aug 28, 2024 at 08:15:38PM +0100, Jessica Clarke wrote:
> On 28 Aug 2024, at 19:55, Mark Johnston <markj@FreeBSD.org> wrote:
> > 
> > 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)))
> 
> This variant is similarly wrong.

Thank you, fixed in cb91dc50950f.