Skip to contentSkip to conversation

e1000e: Fix build with gcc 4.6.3 and ust tracing

PATCH In review Dmitry Fleytman 3 participants 3 messages Jun 4, 2016 – Jun 6, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 e1000e: Fix build with gcc 4.6.3 and ust tracing

This patch fixes used-uninitialized false
positive while compiling with ust tracing
backend plus gcc 4.6.3:

hw/net/e1000e.c: In function ‘e1000e_io_write’:
hw/net/e1000e.c:170:39: error: ‘idx’ may be used uninitialized in this function [-Werror=uninitialized] hw/net/e1000e.c: In function ‘e1000e_io_read’:
hw/net/e1000e.c:145:35: error: ‘idx’ may be used uninitialized in this function [-Werror=uninitialized]
cc1: all warnings being treated as errors
make: *** [hw/net/e1000e.o] Error 1

---
 hw/net/e1000e.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/net/e1000e.c +2 -2
index 61bcbb6..692283f 100644
@@ -133,7 +133,7 @@ static uint64_t
 e1000e_io_read(void *opaque, hwaddr addr, unsigned size)
 {
     E1000EState *s = opaque;
-    uint32_t idx;
+    uint32_t idx = 0;
     uint64_t val;
 
     switch (addr) {
@@ -158,7 +158,7 @@ e1000e_io_write(void *opaque, hwaddr addr,
                 uint64_t val, unsigned size)
 {
     E1000EState *s = opaque;
-    uint32_t idx;
+    uint32_t idx = 0;
 
     switch (addr) {
     case E1000_IOADDR:
Signature · 1 line
2.5.5
Acked-by on v1 1/1
#1 lore raw
Quoted 30 lines · Dmitry Fleytman

This patch fixes used-uninitialized false
positive while compiling with ust tracing
backend plus gcc 4.6.3:

hw/net/e1000e.c: In function ‘e1000e_io_write’:
hw/net/e1000e.c:170:39: error: ‘idx’ may be used uninitialized in this function [-Werror=uninitialized] hw/net/e1000e.c: In function ‘e1000e_io_read’:
hw/net/e1000e.c:145:35: error: ‘idx’ may be used uninitialized in this function [-Werror=uninitialized]
cc1: all warnings being treated as errors
make: *** [hw/net/e1000e.o] Error 1

---
  hw/net/e1000e.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
hw/net/e1000e.c +1 -1
index 61bcbb6..692283f 100644
@@ -133,7 +133,7 @@ static uint64_t
  e1000e_io_read(void *opaque, hwaddr addr, unsigned size)
  {
      E1000EState *s = opaque;
-    uint32_t idx;
+    uint32_t idx = 0;
      uint64_t val;
 
      switch (addr) {

hw/net/e1000e.c e1000e_io_write(void *opaque, hwaddr addr, · line 164

Quoted 8 lines
hw/net/e1000e.c +1 -1
@@ -158,7 +158,7 @@ e1000e_io_write(void *opaque, hwaddr addr,
                  uint64_t val, unsigned size)
  {
      E1000EState *s = opaque;
-    uint32_t idx;
+    uint32_t idx = 0;
 
      switch (addr) {
      case E1000_IOADDR:

Maybe in the future, we need something like uninitialized_var() tricks in Linux for this.

#2 lore raw
Quoted 37 lines · Jason Wang
Quoted 34 lines · Dmitry Fleytman

This patch fixes used-uninitialized false
positive while compiling with ust tracing
backend plus gcc 4.6.3:

hw/net/e1000e.c: In function ‘e1000e_io_write’:
hw/net/e1000e.c:170:39: error: ‘idx’ may be used uninitialized in this function [-Werror=uninitialized]
hw/net/e1000e.c: In function ‘e1000e_io_read’:
hw/net/e1000e.c:145:35: error: ‘idx’ may be used uninitialized in this function [-Werror=uninitialized]
cc1: all warnings being treated as errors
make: *** [hw/net/e1000e.o] Error 1

---
  hw/net/e1000e.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
hw/net/e1000e.c +1 -1
index 61bcbb6..692283f 100644
@@ -133,7 +133,7 @@ static uint64_t
  e1000e_io_read(void *opaque, hwaddr addr, unsigned size)
  {
      E1000EState *s = opaque;
-    uint32_t idx;
+    uint32_t idx = 0;
      uint64_t val;
        switch (addr) {
@@ -158,7 +158,7 @@ e1000e_io_write(void *opaque, hwaddr addr,
                  uint64_t val, unsigned size)
  {
Quoted 8 lines

hw/net/e1000e.c e1000e_io_write(void *opaque, hwaddr addr, · line 164

Quoted 5 lines
hw/net/e1000e.c +1 -1
      E1000EState *s = opaque;
-    uint32_t idx;
+    uint32_t idx = 0;
        switch (addr) {
      case E1000_IOADDR:

Thanks. Applied to master as a buildfix.

-- PMM