[PULL 49/59] linux-user: Fix erroneous conversion in copy_file_range
From: Giuseppe Musacchio 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 Reviewed-by: Laurent Vivier Message-Id: <20210503174159.54302-3-thatle...@gmail.com> Signed-off-by: Laurent Vivier --- linux-user/syscall.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 4d52b2cfe36d..e05870c33884 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -13244,8 +13244,9 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, } poutoff = } +/* 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)) { -- 2.31.1
[PULL 49/59] linux-user: Fix erroneous conversion in copy_file_range
From: Giuseppe Musacchio 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 Reviewed-by: Laurent Vivier Message-Id: <20210503174159.54302-3-thatle...@gmail.com> Signed-off-by: Laurent Vivier --- linux-user/syscall.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 4d52b2cfe36d..e05870c33884 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -13244,8 +13244,9 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, } poutoff = } +/* 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)) { -- 2.31.1