Date: Wed, 28 Aug 2024 15:31:47 -0400 From: Mark Johnston <markj@freebsd.org> To: Jessica Clarke <jrtc27@freebsd.org> Cc: "src-committers@freebsd.org" <src-committers@freebsd.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@freebsd.org>, "dev-commits-src-main@freebsd.org" <dev-commits-src-main@freebsd.org> Subject: 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 Message-ID: <Zs97I3gs2UAJG_Fh@nuc> In-Reply-To: <9559E6F1-0FB5-48E9-9827-50D6BD8E5446@freebsd.org> References: <202408281855.47SItml1024354@gitrepo.freebsd.org> <9559E6F1-0FB5-48E9-9827-50D6BD8E5446@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Zs97I3gs2UAJG_Fh>