Patchwork [Qemu-trivial] migration: Fix compiler warning ('caps' may be used uninitialized)

login
register
mail settings
Submitter Michael Tokarev
Date Oct. 5, 2013, 9:19 a.m.
Message ID <524FD99E.8020205@msgid.tls.msk.ru>
Download mbox | patch
Permalink /patch/280761/
State New
Headers show

Comments

Michael Tokarev - Oct. 5, 2013, 9:19 a.m.
05.10.2013 13:15, Michael Tokarev пишет:
> Okay.  This takes just too long and too many people
> are affected.  I'll just set the variable in question
> (caps) to NULL at entry for now, -- it is not a critical
> path and the current code is correct anyway.  This is
> becoming ridiculous, when there are so many different
> opinions about such a trivial thing, with the result
> being that nothing is fixed.  Setting it to NULL at
> least will let a buildbot to be fixed for now.

Forgot the patch itself.  It is the shortest from all
already proposed ;)

Author: Michael Tokarev <mjt@tls.msk.ru>
Date:   Sat Oct 5 13:18:28 2013 +0400

     migration: Fix compiler warning ('caps' may be used uninitialized)

     Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>



Thanks,

/mjt
Stefan Weil - Oct. 5, 2013, 9:36 a.m.
Am 05.10.2013 11:19, schrieb Michael Tokarev:
>
> Author: Michael Tokarev <mjt@tls.msk.ru>
> Date:   Sat Oct 5 13:18:28 2013 +0400
>
>     migration: Fix compiler warning ('caps' may be used uninitialized)
>
>     Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
>
> diff --git a/migration.c b/migration.c
> index b4f8462..2b1ab20 100644
> --- a/migration.c
> +++ b/migration.c
> @@ -150,6 +150,7 @@ MigrationCapabilityStatusList
> *qmp_query_migrate_capabilitie
>      MigrationState *s = migrate_get_current();
>      int i;
>
> +    caps = NULL; /* silence compiler warning */
>      for (i = 0; i < MIGRATION_CAPABILITY_MAX; i++) {
>          if (head == NULL) {
>              head = g_malloc0(sizeof(*caps));
>
>
> Thanks,
>
> /mjt
>


Reviewed-by: Stefan Weil <sw@weilnetz.de>

Patch

diff --git a/migration.c b/migration.c
index b4f8462..2b1ab20 100644
--- a/migration.c
+++ b/migration.c
@@ -150,6 +150,7 @@  MigrationCapabilityStatusList *qmp_query_migrate_capabilitie
      MigrationState *s = migrate_get_current();
      int i;

+    caps = NULL; /* silence compiler warning */
      for (i = 0; i < MIGRATION_CAPABILITY_MAX; i++) {
          if (head == NULL) {
              head = g_malloc0(sizeof(*caps));