qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] VMXNET3: initialize rx_ridx to eliminate compile warning
@ 2013-03-26  2:24 Wenchao Xia
  2013-03-26  9:16 ` Stefan Hajnoczi
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Wenchao Xia @ 2013-03-26  2:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: dmitry, yan, Wenchao Xia, stefanha

  Gcc report "hw/vmxnet3.c:972: error: ‘rx_ridx’ may be used
uninitialized in this function", so fix it.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
---
 hw/vmxnet3.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hw/vmxnet3.c b/hw/vmxnet3.c
index 925be80..bdd256e 100644
--- a/hw/vmxnet3.c
+++ b/hw/vmxnet3.c
@@ -969,7 +969,7 @@ vmxnet3_indicate_packet(VMXNET3State *s)
     struct Vmxnet3_RxDesc rxd;
     bool is_head = true;
     uint32_t rxd_idx;
-    uint32_t rx_ridx;
+    uint32_t rx_ridx = 0;
 
     struct Vmxnet3_RxCompDesc rxcd;
     uint32_t new_rxcd_gen = VMXNET3_INIT_GEN;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] VMXNET3: initialize rx_ridx to eliminate compile warning
  2013-03-26  2:24 [Qemu-devel] [PATCH] VMXNET3: initialize rx_ridx to eliminate compile warning Wenchao Xia
@ 2013-03-26  9:16 ` Stefan Hajnoczi
  2013-03-26  9:16 ` Stefan Hajnoczi
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2013-03-26  9:16 UTC (permalink / raw)
  To: Wenchao Xia; +Cc: dmitry, yan, Anthony Liguori, qemu-devel

On Tue, Mar 26, 2013 at 10:24:06AM +0800, Wenchao Xia wrote:
>   Gcc report "hw/vmxnet3.c:972: error: ‘rx_ridx’ may be used
> uninitialized in this function", so fix it.
> 
> Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
> ---
>  hw/vmxnet3.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/hw/vmxnet3.c b/hw/vmxnet3.c
> index 925be80..bdd256e 100644
> --- a/hw/vmxnet3.c
> +++ b/hw/vmxnet3.c
> @@ -969,7 +969,7 @@ vmxnet3_indicate_packet(VMXNET3State *s)
>      struct Vmxnet3_RxDesc rxd;
>      bool is_head = true;
>      uint32_t rxd_idx;
> -    uint32_t rx_ridx;
> +    uint32_t rx_ridx = 0;

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

This seems to be a gcc weakness in some versions.

No warnings here with gcc (GCC) 4.7.2 20121109 (Red Hat 4.7.2-8).

I manually checked the code and there is no path which can use
uninitialized rx_ridx:

static bool
vmxnet3_indicate_packet(VMXNET3State *s)
{
    struct Vmxnet3_RxDesc rxd;
    bool is_head = true;
    uint32_t rxd_idx;
    uint32_t rx_ridx;
[...]
    while (bytes_left > 0) {
[...]
        if (!vmxnet3_get_next_rx_descr(s, is_head, &rxd, &rxd_idx, &rx_ridx)) {
            break;
        }

rx_ridx is assigned by vmxnet3_get_next_rx_descr() unless it returns
false.

>From now on rx_ridx is initialized.

[...]
        rxcd.rqID = RXQ_IDX + rx_ridx * s->rxq_num;

Used here, fine since we initialized it above.

[...]
        VMW_RIPRN("RX Completion descriptor: rxRing: %lu rxIdx %lu len %lu "
                  "sop %d csum_correct %lu",
                  (unsigned long) rx_ridx,

Used here, fine since we initialized it above.

[...]
    }

Not used outside the while loop.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] VMXNET3: initialize rx_ridx to eliminate compile warning
  2013-03-26  2:24 [Qemu-devel] [PATCH] VMXNET3: initialize rx_ridx to eliminate compile warning Wenchao Xia
  2013-03-26  9:16 ` Stefan Hajnoczi
@ 2013-03-26  9:16 ` Stefan Hajnoczi
  2013-03-27 13:21 ` Dmitry Fleytman
  2013-04-02 20:21 ` Anthony Liguori
  3 siblings, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2013-03-26  9:16 UTC (permalink / raw)
  To: Wenchao Xia; +Cc: dmitry, yan, qemu-devel

On Tue, Mar 26, 2013 at 10:24:06AM +0800, Wenchao Xia wrote:
>   Gcc report "hw/vmxnet3.c:972: error: ‘rx_ridx’ may be used
> uninitialized in this function", so fix it.
> 
> Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
> ---
>  hw/vmxnet3.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)

Anthony: Please apply this fix directly.  I think there's no need to go
through the net tree.

Stefan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] VMXNET3: initialize rx_ridx to eliminate compile warning
  2013-03-26  2:24 [Qemu-devel] [PATCH] VMXNET3: initialize rx_ridx to eliminate compile warning Wenchao Xia
  2013-03-26  9:16 ` Stefan Hajnoczi
  2013-03-26  9:16 ` Stefan Hajnoczi
@ 2013-03-27 13:21 ` Dmitry Fleytman
  2013-04-02 20:21 ` Anthony Liguori
  3 siblings, 0 replies; 5+ messages in thread
From: Dmitry Fleytman @ 2013-03-27 13:21 UTC (permalink / raw)
  To: Wenchao Xia; +Cc: Yan Vugenfirer, qemu-devel, stefanha

[-- Attachment #1: Type: text/plain, Size: 849 bytes --]

Hi, Wenchao

Thanks for fixing this!

Dmitry.


On Tue, Mar 26, 2013 at 4:24 AM, Wenchao Xia <xiawenc@linux.vnet.ibm.com>wrote:

>   Gcc report "hw/vmxnet3.c:972: error: ‘rx_ridx’ may be used
> uninitialized in this function", so fix it.
>
> Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
> ---
>  hw/vmxnet3.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/hw/vmxnet3.c b/hw/vmxnet3.c
> index 925be80..bdd256e 100644
> --- a/hw/vmxnet3.c
> +++ b/hw/vmxnet3.c
> @@ -969,7 +969,7 @@ vmxnet3_indicate_packet(VMXNET3State *s)
>      struct Vmxnet3_RxDesc rxd;
>      bool is_head = true;
>      uint32_t rxd_idx;
> -    uint32_t rx_ridx;
> +    uint32_t rx_ridx = 0;
>
>      struct Vmxnet3_RxCompDesc rxcd;
>      uint32_t new_rxcd_gen = VMXNET3_INIT_GEN;
> --
> 1.7.1
>
>
>

[-- Attachment #2: Type: text/html, Size: 1337 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] VMXNET3: initialize rx_ridx to eliminate compile warning
  2013-03-26  2:24 [Qemu-devel] [PATCH] VMXNET3: initialize rx_ridx to eliminate compile warning Wenchao Xia
                   ` (2 preceding siblings ...)
  2013-03-27 13:21 ` Dmitry Fleytman
@ 2013-04-02 20:21 ` Anthony Liguori
  3 siblings, 0 replies; 5+ messages in thread
From: Anthony Liguori @ 2013-04-02 20:21 UTC (permalink / raw)
  To: Wenchao Xia, qemu-devel; +Cc: dmitry, yan, stefanha

Applied.  Thanks.

Regards,

Anthony Liguori

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-04-02 20:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-26  2:24 [Qemu-devel] [PATCH] VMXNET3: initialize rx_ridx to eliminate compile warning Wenchao Xia
2013-03-26  9:16 ` Stefan Hajnoczi
2013-03-26  9:16 ` Stefan Hajnoczi
2013-03-27 13:21 ` Dmitry Fleytman
2013-04-02 20:21 ` Anthony Liguori

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).