qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefano Garzarella <sgarzare@redhat.com>
To: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>
Cc: qemu-devel@nongnu.org,
	"open list:Overall KVM CPUs" <kvm@vger.kernel.org>
Subject: Re: [PATCH] accel/kvm: ensure ret always set
Date: Thu, 3 Oct 2019 11:22:13 +0200	[thread overview]
Message-ID: <20191003092213.etjzlwgd7nlnzqay@steredhat> (raw)
In-Reply-To: <05d59eb3-1693-d5f4-0f6d-9642fd46c32a@redhat.com>

On Wed, Oct 02, 2019 at 01:08:40PM +0200, Paolo Bonzini wrote:
> On 02/10/19 12:22, Alex Bennée wrote:
> > Some of the cross compilers rightly complain there are cases where ret
> > may not be set. 0 seems to be the reasonable default unless particular
> > slot explicitly returns -1.
> > 

Even Coverity reported it (CID 1405857).

> > Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> > ---
> >  accel/kvm/kvm-all.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
> > index aabe097c41..d2d96d73e8 100644
> > --- a/accel/kvm/kvm-all.c
> > +++ b/accel/kvm/kvm-all.c
> > @@ -712,11 +712,11 @@ static int kvm_physical_log_clear(KVMMemoryListener *kml,
> >      KVMState *s = kvm_state;
> >      uint64_t start, size, offset, count;
> >      KVMSlot *mem;
> > -    int ret, i;
> > +    int ret = 0, i;
> >  
> >      if (!s->manual_dirty_log_protect) {
> >          /* No need to do explicit clear */
> > -        return 0;
> > +        return ret;
> >      }
> >  
> >      start = section->offset_within_address_space;
> > @@ -724,7 +724,7 @@ static int kvm_physical_log_clear(KVMMemoryListener *kml,
> >  
> >      if (!size) {
> >          /* Nothing more we can do... */
> > -        return 0;
> > +        return ret;
> >      }
> >  
> >      kvm_slots_lock(kml);
> > 
> 
> Queued, thanks.
> 
> Paolo
> 

-- 


  reply	other threads:[~2019-10-03  9:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-02 10:22 [PATCH] accel/kvm: ensure ret always set Alex Bennée
2019-10-02 11:08 ` Paolo Bonzini
2019-10-03  9:22   ` Stefano Garzarella [this message]
2019-10-03 10:18     ` Philippe Mathieu-Daudé
2019-10-03 12:15       ` Alex Bennée

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=20191003092213.etjzlwgd7nlnzqay@steredhat \
    --to=sgarzare@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).