Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Aug 2024 20:15:38 +0100
From:      Jessica Clarke <jrtc27@freebsd.org>
To:        Mark Johnston <markj@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:  <9559E6F1-0FB5-48E9-9827-50D6BD8E5446@freebsd.org>
In-Reply-To: <202408281855.47SItml1024354@gitrepo.freebsd.org>
References:  <202408281855.47SItml1024354@gitrepo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 28 Aug 2024, at 19:55, Mark Johnston <markj@FreeBSD.org> wrote:
>=20
> The branch main has been updated by markj:
>=20
> URL: =
https://cgit.FreeBSD.org/src/commit/?id=3Dc7a7e997d25d0b33769252d002b16839=
c864c83d
>=20
> 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
>=20
>    atomic: Avoid casting the return value of atomic_load_ptr to void *
>=20
>    Otherwise a cast is needed to load a uintptr_t value.
>=20
>    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(-)
>=20
> 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.

Jess




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9559E6F1-0FB5-48E9-9827-50D6BD8E5446>