qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: peter.maydell@linaro.org
Cc: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
	Jason Wang <jasowang@redhat.com>
Subject: [Qemu-devel] [PULL 2/5] net: e1000e: fix dead code in e1000e_write_packet_to_guest
Date: Wed, 15 Feb 2017 11:53:19 +0800	[thread overview]
Message-ID: <1487130802-27953-3-git-send-email-jasowang@redhat.com> (raw)
In-Reply-To: <1487130802-27953-1-git-send-email-jasowang@redhat.com>

From: Paolo Bonzini <pbonzini@redhat.com>

Because is_first is declared inside a loop, it is always true.  The store
is dead, and so is the "else" branch of "if (is_first)".  is_last is
okay though.

Reported by Coverity.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 hw/net/e1000e_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c
index 2b11499..c99e2fb 100644
--- a/hw/net/e1000e_core.c
+++ b/hw/net/e1000e_core.c
@@ -1507,6 +1507,7 @@ e1000e_write_packet_to_guest(E1000ECore *core, struct NetRxPkt *pkt,
     const E1000E_RingInfo *rxi;
     size_t ps_hdr_len = 0;
     bool do_ps = e1000e_do_ps(core, pkt, &ps_hdr_len);
+    bool is_first = true;
 
     rxi = rxr->i;
 
@@ -1514,7 +1515,6 @@ e1000e_write_packet_to_guest(E1000ECore *core, struct NetRxPkt *pkt,
         hwaddr ba[MAX_PS_BUFFERS];
         e1000e_ba_state bastate = { { 0 } };
         bool is_last = false;
-        bool is_first = true;
 
         desc_size = total_size - desc_offset;
 
-- 
2.7.4

  parent reply	other threads:[~2017-02-15  3:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-15  3:53 [Qemu-devel] [PULL 0/5] Net patches Jason Wang
2017-02-15  3:53 ` [Qemu-devel] [PULL 1/5] net: Mark 'vlan' parameter as deprecated Jason Wang
2017-02-15  3:53 ` Jason Wang [this message]
2017-02-15  3:53 ` [Qemu-devel] [PULL 3/5] colo-compare: sort TCP packet queue by sequence number Jason Wang
2017-02-15  3:53 ` [Qemu-devel] [PULL 4/5] net: imx: limit buffer descriptor count Jason Wang
2017-02-15  3:53 ` [Qemu-devel] [PULL 5/5] net: e1000e: fix an infinite loop issue Jason Wang
2017-02-16 14:23 ` [Qemu-devel] [PULL 0/5] Net patches Peter Maydell

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=1487130802-27953-3-git-send-email-jasowang@redhat.com \
    --to=jasowang@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --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).