qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: qemu-devel@nongnu.org, Juan Quintela <quintela@redhat.com>
Subject: Re: [PATCH] migration: remove unreachable code after reading data
Date: Mon, 27 Jun 2022 15:22:46 +0100	[thread overview]
Message-ID: <Yrm9NsPN3RQUmZ6j@work-vm> (raw)
In-Reply-To: <20220627135318.156121-1-berrange@redhat.com>

* Daniel P. Berrangé (berrange@redhat.com) wrote:
> The code calls qio_channel_read() in a loop when it reports
> QIO_CHANNEL_ERR_BLOCK. This code is reported when errno==EAGAIN.
> 
> As such the later block of code will always hit the 'errno != EAGAIN'
> condition, making the final 'else' unreachable.
> 
> Fixes: Coverity CID 1490203
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

> ---
>  migration/qemu-file.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/migration/qemu-file.c b/migration/qemu-file.c
> index 1e80d496b7..1615c48b7e 100644
> --- a/migration/qemu-file.c
> +++ b/migration/qemu-file.c
> @@ -384,10 +384,8 @@ static ssize_t qemu_fill_buffer(QEMUFile *f)
>          f->total_transferred += len;
>      } else if (len == 0) {
>          qemu_file_set_error_obj(f, -EIO, local_error);
> -    } else if (len != -EAGAIN) {
> -        qemu_file_set_error_obj(f, len, local_error);
>      } else {
> -        error_free(local_error);
> +        qemu_file_set_error_obj(f, len, local_error);
>      }
>  
>      return len;
> -- 
> 2.36.1
> 
-- 
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK



  reply	other threads:[~2022-06-27 14:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-27 13:53 [PATCH] migration: remove unreachable code after reading data Daniel P. Berrangé
2022-06-27 14:22 ` Dr. David Alan Gilbert [this message]
2022-07-19 13:51 ` Dr. David Alan Gilbert

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=Yrm9NsPN3RQUmZ6j@work-vm \
    --to=dgilbert@redhat.com \
    --cc=berrange@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /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).