qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] e1000e: Fix build with gcc 4.6.3 and ust tracing
@ 2016-06-04  7:02 Dmitry Fleytman
  2016-06-06  1:18 ` Jason Wang
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Fleytman @ 2016-06-04  7:02 UTC (permalink / raw)
  To: qemu-devel
  Cc: Jason Wang, Yan Vugenfirer, Leonid Bloch, Shmulik Ladkani,
	Peter Maydell

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

Signed-off-by: Dmitry Fleytman <dmitry@daynix.com>
---
 hw/net/e1000e.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c
index 61bcbb6..692283f 100644
--- a/hw/net/e1000e.c
+++ b/hw/net/e1000e.c
@@ -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:
-- 
2.5.5

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

* Re: [Qemu-devel] [PATCH] e1000e: Fix build with gcc 4.6.3 and ust tracing
  2016-06-04  7:02 [Qemu-devel] [PATCH] e1000e: Fix build with gcc 4.6.3 and ust tracing Dmitry Fleytman
@ 2016-06-06  1:18 ` Jason Wang
  2016-06-06  9:06   ` Peter Maydell
  0 siblings, 1 reply; 3+ messages in thread
From: Jason Wang @ 2016-06-06  1:18 UTC (permalink / raw)
  To: Dmitry Fleytman, qemu-devel
  Cc: Yan Vugenfirer, Peter Maydell, Leonid Bloch, Shmulik Ladkani



On 2016年06月04日 15:02, Dmitry Fleytman wrote:
> 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
>
> Signed-off-by: Dmitry Fleytman <dmitry@daynix.com>
> ---
>   hw/net/e1000e.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c
> index 61bcbb6..692283f 100644
> --- a/hw/net/e1000e.c
> +++ b/hw/net/e1000e.c
> @@ -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:

Acked-by: Jason Wang <jasowang@redhat.com>

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

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

* Re: [Qemu-devel] [PATCH] e1000e: Fix build with gcc 4.6.3 and ust tracing
  2016-06-06  1:18 ` Jason Wang
@ 2016-06-06  9:06   ` Peter Maydell
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2016-06-06  9:06 UTC (permalink / raw)
  To: Jason Wang
  Cc: Dmitry Fleytman, QEMU Developers, Yan Vugenfirer, Leonid Bloch,
	Shmulik Ladkani

On 6 June 2016 at 02:18, Jason Wang <jasowang@redhat.com> wrote:
>
>
> On 2016年06月04日 15:02, Dmitry Fleytman wrote:
>>
>> 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
>>
>> Signed-off-by: Dmitry Fleytman <dmitry@daynix.com>
>> ---
>>   hw/net/e1000e.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c
>> index 61bcbb6..692283f 100644
>> --- a/hw/net/e1000e.c
>> +++ b/hw/net/e1000e.c
>> @@ -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:
>
>
> Acked-by: Jason Wang <jasowang@redhat.com>

Thanks. Applied to master as a buildfix.

-- PMM

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

end of thread, other threads:[~2016-06-06  9:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-04  7:02 [Qemu-devel] [PATCH] e1000e: Fix build with gcc 4.6.3 and ust tracing Dmitry Fleytman
2016-06-06  1:18 ` Jason Wang
2016-06-06  9:06   ` Peter Maydell

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