[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>
- [PATCH v2 4/8] linux-user/alpha: Move errno definitions to 'target_errno_defs.h', (continued)
- [PATCH v2 4/8] linux-user/alpha: Move errno definitions to 'target_errno_defs.h', Philippe Mathieu-Daudé, 2021/07/08
- [PATCH v2 5/8] linux-user/hppa: Move errno definitions to 'target_errno_defs.h', Philippe Mathieu-Daudé, 2021/07/08
- [PATCH v2 6/8] linux-user/mips: Move errno definitions to 'target_errno_defs.h', Philippe Mathieu-Daudé, 2021/07/08
- [PATCH v2 7/8] linux-user/syscall: Introduce errno_exists(), Philippe Mathieu-Daudé, 2021/07/08
- [PATCH v2 8/8] linux-user: Simplify host <-> target errno conversion using macros, Philippe Mathieu-Daudé, 2021/07/08