diff mbox series

[1/4] linux-user: Do not special-case NULL for PR_GET_PDEATHSIG

Message ID 20220106225738.103012-2-richard.henderson@linaro.org
State Superseded
Headers show
Series linux-user: prctl follow-ups | expand

Commit Message

Richard Henderson Jan. 6, 2022, 10:57 p.m. UTC
The kernel does not special-case arg2 != NULL, so
neither should we.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/syscall.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Laurent Vivier Jan. 8, 2022, 5:10 p.m. UTC | #1
Le 06/01/2022 à 23:57, Richard Henderson a écrit :
> The kernel does not special-case arg2 != NULL, so
> neither should we.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   linux-user/syscall.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index ce9d64896c..e8f9e0643e 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -6444,7 +6444,7 @@ static abi_long do_prctl(CPUArchState *env, abi_long option, abi_long arg2,
>               int deathsig;
>               ret = get_errno(prctl(PR_GET_PDEATHSIG, &deathsig,
>                                     arg3, arg4, arg5));
> -            if (!is_error(ret) && arg2 && put_user_s32(deathsig, arg2)) {
> +            if (!is_error(ret) && put_user_s32(deathsig, arg2)) {
>                   return -TARGET_EFAULT;
>               }
>               return ret;

Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Laurent Vivier Jan. 8, 2022, 5:13 p.m. UTC | #2
Le 08/01/2022 à 18:10, Laurent Vivier a écrit :
> Le 06/01/2022 à 23:57, Richard Henderson a écrit :
>> The kernel does not special-case arg2 != NULL, so
>> neither should we.
>>
>> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
>> ---
>>   linux-user/syscall.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
>> index ce9d64896c..e8f9e0643e 100644
>> --- a/linux-user/syscall.c
>> +++ b/linux-user/syscall.c
>> @@ -6444,7 +6444,7 @@ static abi_long do_prctl(CPUArchState *env, abi_long option, abi_long arg2,
>>               int deathsig;
>>               ret = get_errno(prctl(PR_GET_PDEATHSIG, &deathsig,
>>                                     arg3, arg4, arg5));
>> -            if (!is_error(ret) && arg2 && put_user_s32(deathsig, arg2)) {
>> +            if (!is_error(ret) && put_user_s32(deathsig, arg2)) {
>>                   return -TARGET_EFAULT;
>>               }
>>               return ret;
> 
> Reviewed-by: Laurent Vivier <laurent@vivier.eu>
> 

Reviewed-by: Laurent Vivier <laurent@vivier.eu>
diff mbox series

Patch

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index ce9d64896c..e8f9e0643e 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6444,7 +6444,7 @@  static abi_long do_prctl(CPUArchState *env, abi_long option, abi_long arg2,
             int deathsig;
             ret = get_errno(prctl(PR_GET_PDEATHSIG, &deathsig,
                                   arg3, arg4, arg5));
-            if (!is_error(ret) && arg2 && put_user_s32(deathsig, arg2)) {
+            if (!is_error(ret) && put_user_s32(deathsig, arg2)) {
                 return -TARGET_EFAULT;
             }
             return ret;