[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v1 1/1] linux-user/syscall: Fix missing target_to_host_timesp
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH v1 1/1] linux-user/syscall: Fix missing target_to_host_timespec64() check |
Date: |
Tue, 3 Nov 2020 21:39:40 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 |
On 11/3/20 8:48 PM, Alistair Francis wrote:
> Coverity pointed out (CID 1432339) that target_to_host_timespec64() can
> fail with -TARGET_EFAULT but we never check the return value. This patch
> checks the return value and handles the error.
>
> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> linux-user/syscall.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 6fef8181e7..3160a9ba06 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -7592,7 +7592,9 @@ static int do_futex_time64(target_ulong uaddr, int op,
> int val, target_ulong tim
> case FUTEX_WAIT_BITSET:
> if (timeout) {
> pts = &ts;
> - target_to_host_timespec64(pts, timeout);
> + if (target_to_host_timespec64(pts, timeout)) {
> + return -TARGET_EFAULT;
> + }
> } else {
> pts = NULL;
> }
>