]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Linux: fix tst-copy_file_range-large test on 32-bit platforms.
authorCollin Funk <collin.funk1@gmail.com>
Mon, 27 Oct 2025 02:06:08 +0000 (19:06 -0700)
committerCollin Funk <collin.funk1@gmail.com>
Mon, 27 Oct 2025 02:39:49 +0000 (19:39 -0700)
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.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
sysdeps/unix/sysv/linux/tst-copy_file_range-large.c

index 9eafb8c425fe87187f8722aa7441cf7f085fc93a..2ad679be6b16a248c7e28733229336399ce0b736 100644 (file)
@@ -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);