]> git.proxmox.com Git - mirror_qemu.git/commitdiff
linux-user: Fix erroneous conversion in copy_file_range
authorGiuseppe Musacchio <thatlemon@gmail.com>
Mon, 3 May 2021 17:41:59 +0000 (19:41 +0200)
committerLaurent Vivier <laurent@vivier.eu>
Tue, 18 May 2021 05:09:58 +0000 (07:09 +0200)
The implicit cast from abi_long to size_t may introduce an intermediate
unwanted sign-extension of the value for 32bit targets running on 64bit
hosts.

Signed-off-by: Giuseppe Musacchio <thatlemon@gmail.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20210503174159.54302-3-thatlemon@gmail.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
linux-user/syscall.c

index 4d52b2cfe36df7d7bcde8584603da88496526e5b..e05870c33884f4511e3d7c134d3c95bc80b70dc7 100644 (file)
@@ -13244,8 +13244,9 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
                 }
                 poutoff = &outoff;
             }
+            /* Do not sign-extend the count parameter. */
             ret = get_errno(safe_copy_file_range(arg1, pinoff, arg3, poutoff,
-                                                 arg5, arg6));
+                                                 (abi_ulong)arg5, arg6));
             if (!is_error(ret) && ret > 0) {
                 if (arg2) {
                     if (put_user_u64(inoff, arg2)) {