[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] linux-user: Add missing check for return value
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH] linux-user: Add missing check for return value of lock_user |
Date: |
Mon, 19 Oct 2015 16:28:43 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
On 14/03/2015 16:12, Stefan Weil wrote:
> This fixes a warning from Coverity:
> "Dereference null return value (NULL_RETURNS)"
>
> Signed-off-by: Stefan Weil <address@hidden>
> ---
> linux-user/flatload.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/linux-user/flatload.c b/linux-user/flatload.c
> index 566a7a8..56ac790 100644
> --- a/linux-user/flatload.c
> +++ b/linux-user/flatload.c
> @@ -97,11 +97,13 @@ static int target_pread(int fd, abi_ulong ptr, abi_ulong
> len,
> abi_ulong offset)
> {
> void *buf;
> - int ret;
> + int ret = -TARGET_EFAULT;
>
> buf = lock_user(VERIFY_WRITE, ptr, len, 0);
> - ret = pread(fd, buf, len, offset);
> - unlock_user(buf, ptr, len);
> + if (buf) {
> + ret = pread(fd, buf, len, offset);
> + unlock_user(buf, ptr, len);
> + }
> return ret;
> }
>
> /****************************************************************************/
>
Hi Stefan,
are you going to update and resend this patch?
Thanks,
Paolo
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Qemu-devel] [PATCH] linux-user: Add missing check for return value of lock_user,
Paolo Bonzini <=