]> git.proxmox.com Git - mirror_qemu.git/commitdiff
net: e1000e: fix dead code in e1000e_write_packet_to_guest
authorPaolo Bonzini <pbonzini@redhat.com>
Thu, 26 Jan 2017 10:10:10 +0000 (11:10 +0100)
committerJason Wang <jasowang@redhat.com>
Wed, 15 Feb 2017 03:18:57 +0000 (11:18 +0800)
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

index 2b11499829f2d4f660eaeede5de2784b916fcaff..c99e2fbd625d29aeba04796890fe4c44fcf85021 100644 (file)
@@ -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;