[PATCH 1/4] x86: Fix ptrdiff_t for x86_64

Simon Glass sjg at chromium.org
Tue Aug 6 23:50:39 CEST 2024


On Fri, 2 Aug 2024 at 04:08, Richard Weinberger <richard at nod.at> wrote:
>
> sbrk() assumes ptrdiff_t is large enough to enlarge/shrink the heap
> by LONG_MIN/LONG_MAX.
> So, use the long type, also to match the rest of the Linux ecosystem.
>
> Signed-off-by: Richard Weinberger <richard at nod.at>
> ---
>  arch/x86/include/asm/posix_types.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>

Reviewed-by: Simon Glass <sjg at chromium.org>


> diff --git a/arch/x86/include/asm/posix_types.h b/arch/x86/include/asm/posix_types.h
> index dbcea7f47f..e1ed9bcabc 100644
> --- a/arch/x86/include/asm/posix_types.h
> +++ b/arch/x86/include/asm/posix_types.h
> @@ -20,11 +20,12 @@ typedef unsigned short      __kernel_gid_t;
>  #if defined(__x86_64__)
>  typedef unsigned long  __kernel_size_t;
>  typedef long           __kernel_ssize_t;
> +typedef long           __kernel_ptrdiff_t;
>  #else
>  typedef unsigned int   __kernel_size_t;
>  typedef int            __kernel_ssize_t;
> -#endif
>  typedef int            __kernel_ptrdiff_t;
> +#endif
>  typedef long           __kernel_time_t;
>  typedef long           __kernel_suseconds_t;
>  typedef long           __kernel_clock_t;
> --
> 2.35.3
>


More information about the U-Boot mailing list