qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 7/8] linux-user/syscall: Introduce errno_exists()


From: Laurent Vivier
Subject: Re: [PATCH v2 7/8] linux-user/syscall: Introduce errno_exists()
Date: Thu, 8 Jul 2021 17:25:37 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0

Le 08/07/2021 à 16:11, Philippe Mathieu-Daudé a écrit :
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  linux-user/syscall.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 4842a1987b7..56682b06cbd 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -509,6 +509,11 @@ static inline int next_free_host_timer(void)
>  
>  #define ERRNO_TABLE_SIZE 1200
>  
> +static inline bool errno_exists(int err)
> +{
> +    return err >= 0 && err < ERRNO_TABLE_SIZE;
> +}
> +
>  /* target_to_host_errno_table[] is initialized from
>   * host_to_target_errno_table[] in syscall_init(). */
>  static uint16_t target_to_host_errno_table[ERRNO_TABLE_SIZE] = {
> @@ -672,7 +677,7 @@ const char *target_strerror(int err)
>          return "Successful exit from sigreturn";
>      }
>  
> -    if ((err >= ERRNO_TABLE_SIZE) || (err < 0)) {
> +    if (!errno_exists(err)) {
>          return NULL;
>      }
>      return strerror(target_to_host_errno(err));
> 

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]