All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/1] migration: fix compiler warning on uninitialized variable
@ 2016-10-31 21:50 Jeff Cody
  2016-11-01  1:12 ` Hailiang Zhang
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jeff Cody @ 2016-10-31 21:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-block, mark.cave-ayland, zhang.zhanghailiang, quintela

Some older GCC versions (e.g. 4.4.7) report a warning on an
uninitialized variable for 'request', even though all possible code
paths that reference 'request' will be initialized.   To appease
these versions, initialize the variable to 0.

Reported-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Jeff Cody <jcody@redhat.com>
---
 migration/colo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/migration/colo.c b/migration/colo.c
index e7224b8..93c85c5 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -439,7 +439,7 @@ void *colo_process_incoming_thread(void *opaque)
     }
 
     while (mis->state == MIGRATION_STATUS_COLO) {
-        int request;
+        int request = 0;
 
         colo_wait_handle_message(mis->from_src_file, &request, &local_err);
         if (local_err) {
-- 
2.7.4

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

* Re: [Qemu-devel] [PATCH 1/1] migration: fix compiler warning on uninitialized variable
  2016-10-31 21:50 [Qemu-devel] [PATCH 1/1] migration: fix compiler warning on uninitialized variable Jeff Cody
@ 2016-11-01  1:12 ` Hailiang Zhang
  2016-11-01 10:20 ` Peter Maydell
  2016-11-02  7:30 ` Mark Cave-Ayland
  2 siblings, 0 replies; 4+ messages in thread
From: Hailiang Zhang @ 2016-11-01  1:12 UTC (permalink / raw)
  To: Jeff Cody, qemu-devel
  Cc: qemu-block, mark.cave-ayland, quintela, Michael Tokarev, qemu-trivial

On 2016/11/1 5:50, Jeff Cody wrote:
> Some older GCC versions (e.g. 4.4.7) report a warning on an
> uninitialized variable for 'request', even though all possible code
> paths that reference 'request' will be initialized.   To appease
> these versions, initialize the variable to 0.
>

Thanks for reporting this,  I think this patch can go through trivial
branch.

Cc: Michael Tokarev <mjt@tls.msk.ru>
Cc: qemu-trivial@nongnu.org

> Reported-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> Signed-off-by: Jeff Cody <jcody@redhat.com>

Reviewed-by: zhanghailiang <zhang.zhanghailiang@huawei.com>

> ---
>   migration/colo.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/migration/colo.c b/migration/colo.c
> index e7224b8..93c85c5 100644
> --- a/migration/colo.c
> +++ b/migration/colo.c
> @@ -439,7 +439,7 @@ void *colo_process_incoming_thread(void *opaque)
>       }
>
>       while (mis->state == MIGRATION_STATUS_COLO) {
> -        int request;
> +        int request = 0;
>
>           colo_wait_handle_message(mis->from_src_file, &request, &local_err);
>           if (local_err) {
>

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

* Re: [Qemu-devel] [PATCH 1/1] migration: fix compiler warning on uninitialized variable
  2016-10-31 21:50 [Qemu-devel] [PATCH 1/1] migration: fix compiler warning on uninitialized variable Jeff Cody
  2016-11-01  1:12 ` Hailiang Zhang
@ 2016-11-01 10:20 ` Peter Maydell
  2016-11-02  7:30 ` Mark Cave-Ayland
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2016-11-01 10:20 UTC (permalink / raw)
  To: Jeff Cody
  Cc: QEMU Developers, Mark Cave-Ayland, zhanghailiang, Qemu-block,
	Juan Quintela

On 31 October 2016 at 21:50, Jeff Cody <jcody@redhat.com> wrote:
> Some older GCC versions (e.g. 4.4.7) report a warning on an
> uninitialized variable for 'request', even though all possible code
> paths that reference 'request' will be initialized.   To appease
> these versions, initialize the variable to 0.
>
> Reported-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> Signed-off-by: Jeff Cody <jcody@redhat.com>
> ---
>  migration/colo.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/migration/colo.c b/migration/colo.c
> index e7224b8..93c85c5 100644
> --- a/migration/colo.c
> +++ b/migration/colo.c
> @@ -439,7 +439,7 @@ void *colo_process_incoming_thread(void *opaque)
>      }
>
>      while (mis->state == MIGRATION_STATUS_COLO) {
> -        int request;
> +        int request = 0;
>
>          colo_wait_handle_message(mis->from_src_file, &request, &local_err);
>          if (local_err) {
> --
> 2.7.4

Thanks, applied to master as a buildfix.

-- PMM

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

* Re: [Qemu-devel] [PATCH 1/1] migration: fix compiler warning on uninitialized variable
  2016-10-31 21:50 [Qemu-devel] [PATCH 1/1] migration: fix compiler warning on uninitialized variable Jeff Cody
  2016-11-01  1:12 ` Hailiang Zhang
  2016-11-01 10:20 ` Peter Maydell
@ 2016-11-02  7:30 ` Mark Cave-Ayland
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Cave-Ayland @ 2016-11-02  7:30 UTC (permalink / raw)
  To: Jeff Cody, qemu-devel; +Cc: qemu-block, zhang.zhanghailiang, quintela

On 31/10/16 21:50, Jeff Cody wrote:

> Some older GCC versions (e.g. 4.4.7) report a warning on an
> uninitialized variable for 'request', even though all possible code
> paths that reference 'request' will be initialized.   To appease
> these versions, initialize the variable to 0.
> 
> Reported-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> Signed-off-by: Jeff Cody <jcody@redhat.com>
> ---
>  migration/colo.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/migration/colo.c b/migration/colo.c
> index e7224b8..93c85c5 100644
> --- a/migration/colo.c
> +++ b/migration/colo.c
> @@ -439,7 +439,7 @@ void *colo_process_incoming_thread(void *opaque)
>      }
>  
>      while (mis->state == MIGRATION_STATUS_COLO) {
> -        int request;
> +        int request = 0;
>  
>          colo_wait_handle_message(mis->from_src_file, &request, &local_err);
>          if (local_err) {
> 

Hi Jeff,

I can confirm that this patch fixes the issue for me (and indeed I see
that Peter has already applied this to git master as a build fix).


Many thanks,

Mark.

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

end of thread, other threads:[~2016-11-02  7:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-31 21:50 [Qemu-devel] [PATCH 1/1] migration: fix compiler warning on uninitialized variable Jeff Cody
2016-11-01  1:12 ` Hailiang Zhang
2016-11-01 10:20 ` Peter Maydell
2016-11-02  7:30 ` Mark Cave-Ayland

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.