* [Qemu-devel] [PATCH] net: e1000e: fix dead code in e1000e_write_packet_to_guest
@ 2017-01-26 10:10 Paolo Bonzini
2017-01-26 16:19 ` Dmitry Fleytman
2017-02-03 2:43 ` Jason Wang
0 siblings, 2 replies; 3+ messages in thread
From: Paolo Bonzini @ 2017-01-26 10:10 UTC (permalink / raw)
To: qemu-devel; +Cc: dmitry, jasowang
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>
---
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.9.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] net: e1000e: fix dead code in e1000e_write_packet_to_guest
2017-01-26 10:10 [Qemu-devel] [PATCH] net: e1000e: fix dead code in e1000e_write_packet_to_guest Paolo Bonzini
@ 2017-01-26 16:19 ` Dmitry Fleytman
2017-02-03 2:43 ` Jason Wang
1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Fleytman @ 2017-01-26 16:19 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: qemu-devel, jasowang
Good catch!
Reviewed-by: Dmitry Fleytman <dmitry@daynix.com>
> On 26 Jan 2017, at 12:10 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> 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>
> ---
> 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.9.3
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] net: e1000e: fix dead code in e1000e_write_packet_to_guest
2017-01-26 10:10 [Qemu-devel] [PATCH] net: e1000e: fix dead code in e1000e_write_packet_to_guest Paolo Bonzini
2017-01-26 16:19 ` Dmitry Fleytman
@ 2017-02-03 2:43 ` Jason Wang
1 sibling, 0 replies; 3+ messages in thread
From: Jason Wang @ 2017-02-03 2:43 UTC (permalink / raw)
To: Paolo Bonzini, qemu-devel; +Cc: dmitry
On 2017年01月26日 18:10, Paolo Bonzini wrote:
> 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>
> ---
> 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;
>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-02-03 2:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-26 10:10 [Qemu-devel] [PATCH] net: e1000e: fix dead code in e1000e_write_packet_to_guest Paolo Bonzini
2017-01-26 16:19 ` Dmitry Fleytman
2017-02-03 2:43 ` Jason Wang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.