Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Dec 2020 20:32:26 +0000
From:      Jessica Clarke <jrtc27@freebsd.org>
To:        John Baldwin <jhb@freebsd.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r368738 - head/sys/compat/linuxkpi/common/include/linux
Message-ID:  <085D2B00-C0DC-4D4F-80AC-C8754302ABB3@freebsd.org>
In-Reply-To: <202012172028.0BHKSsf4099202@repo.freebsd.org>
References:  <202012172028.0BHKSsf4099202@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 17 Dec 2020, at 20:28, John Baldwin <jhb@freebsd.org> wrote:
>=20
> Author: jhb
> Date: Thu Dec 17 20:28:53 2020
> New Revision: 368738
> URL: https://svnweb.freebsd.org/changeset/base/368738
>=20
> Log:
>  Cleanups to *ERR* compat shims.
>=20
>  - Use [u]intptr_t casts to convert pointers to integers.
>=20
>  - Change IS_ERR* to return bool instead of long.
>=20
>  Reviewed by:	manu
>  Obtained from:	CheriBSD
>  Sponsored by:	DARPA
>  Differential Revision:	https://reviews.freebsd.org/D27577
>=20
> Modified:
>  head/sys/compat/linuxkpi/common/include/linux/err.h
>=20
> Modified: head/sys/compat/linuxkpi/common/include/linux/err.h
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/compat/linuxkpi/common/include/linux/err.h	Thu Dec =
17 20:11:31 2020	(r368737)
> +++ head/sys/compat/linuxkpi/common/include/linux/err.h	Thu Dec =
17 20:28:53 2020	(r368738)
> @@ -37,30 +37,30 @@
>=20
> #define MAX_ERRNO	4095
>=20
> -#define IS_ERR_VALUE(x) unlikely((x) >=3D (unsigned long)-MAX_ERRNO)
> +#define IS_ERR_VALUE(x) unlikely((x) >=3D (uintptr_t)-MAX_ERRNO)
>=20
> static inline void *
> ERR_PTR(long error)
> {
> -	return (void *)error;
> +	return (void *)(intptr_t)error;
> }
>=20
> static inline long
> PTR_ERR(const void *ptr)
> {
> -	return (long)ptr;
> +	return (intptr_t)ptr;

This should probably be (long)(intptr_t) after no longer changing the
return type to intptr_t?

Jess




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?085D2B00-C0DC-4D4F-80AC-C8754302ABB3>