qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Stefan Weil <sw@weilnetz.de>, QEMU Trivial <qemu-trivial@nongnu.org>
Cc: Riku Voipio <riku.voipio@iki.fi>, QEMU Developer <qemu-devel@nongnu.org>
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	[thread overview]
Message-ID: <5624FE1B.7010202@redhat.com> (raw)
In-Reply-To: <1426345935-7721-1-git-send-email-sw@weilnetz.de>



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 <sw@weilnetz.de>
> ---
>  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

      parent reply	other threads:[~2015-10-19 14:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-14 15:12 [Qemu-devel] [PATCH] linux-user: Add missing check for return value of lock_user Stefan Weil
2015-03-15 11:15 ` Peter Maydell
2015-10-19 14:28 ` Paolo Bonzini [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5624FE1B.7010202@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=riku.voipio@iki.fi \
    --cc=sw@weilnetz.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).