[PATCH] Linux: fix tst-copy_file_range-large test on 32-bit platforms.

H.J. Lu hjl.tools@gmail.com
Mon Oct 27 02:37:03 GMT 2025


On Mon, Oct 27, 2025 at 10:06 AM Collin Funk <collin.funk1@gmail.com> wrote:
>
> Since SSIZE_MAX is less than UINT_MAX on 32-bit platforms we must AND
> the expression with SSIZE_MAX.
>
> Tested on x86_64 and x86.
> ---
>  sysdeps/unix/sysv/linux/tst-copy_file_range-large.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/sysdeps/unix/sysv/linux/tst-copy_file_range-large.c b/sysdeps/unix/sysv/linux/tst-copy_file_range-large.c
> index 9eafb8c425..2ad679be6b 100644
> --- a/sysdeps/unix/sysv/linux/tst-copy_file_range-large.c
> +++ b/sysdeps/unix/sysv/linux/tst-copy_file_range-large.c
> @@ -174,9 +174,11 @@ test_size (struct support_fuse *f, off64_t size)
>       silently clamped to UINT_MAX & PAGE_MASK.  Accept that return value
>       too.  See:
>       <https://github.com/torvalds/linux/commit/1e08938c3694f707bb165535df352ac97a8c75c9>.
> +     We must AND the expression with SSIZE_MAX for 32-bit platforms where
> +     SSIZE_MAX is less than UINT_MAX.
>    */
>    if (copied != size)
> -    TEST_COMPARE (copied, UINT_MAX & ~(getpagesize () - 1));
> +    TEST_COMPARE (copied, (UINT_MAX & ~(getpagesize () - 1)) & SSIZE_MAX);
>
>    xclose (dest_fd);
>    xclose (source_fd);
> --
> 2.51.0
>

LGTM.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>

Thanks.

-- 
H.J.


More information about the Libc-alpha mailing list