qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Janosch Frank <frankja@linux.ibm.com>, qemu-devel@nongnu.org
Cc: QEMU Trivial <qemu-trivial@nongnu.org>,
	pbonzini@redhat.com, cohuck@redhat.com, borntraeger@de.ibm.com
Subject: Re: [PATCH] qobject: Fix maybe uninitialized in qdict_array_split
Date: Mon, 31 May 2021 11:44:48 +0200	[thread overview]
Message-ID: <97b11fa8-fd32-9f73-612b-dc4209e5b32e@redhat.com> (raw)
In-Reply-To: <b4aebccf-db62-74da-ebd0-8ca24ea22f59@linux.ibm.com>

On 5/31/21 11:21 AM, Janosch Frank wrote:
> On 5/18/21 3:06 PM, Janosch Frank wrote:
>> Lets make the compiler happy.
>>
>> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> 
> Ping
> My build is still breaking on Ubuntu because of this.
> 
>> ---
>>  qobject/block-qdict.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/qobject/block-qdict.c b/qobject/block-qdict.c
>> index 1487cc5dd8..b26524429c 100644
>> --- a/qobject/block-qdict.c
>> +++ b/qobject/block-qdict.c
>> @@ -224,7 +224,7 @@ void qdict_array_split(QDict *src, QList **dst)
>>      for (i = 0; i < UINT_MAX; i++) {
>>          QObject *subqobj;
>>          bool is_subqdict;
>> -        QDict *subqdict;
>> +        QDict *subqdict = NULL;
>>          char indexstr[32], prefix[32];
>>          size_t snprintf_ret;

Slightly clearer:

-- >8 --
diff --git a/qobject/block-qdict.c b/qobject/block-qdict.c
index 1487cc5dd8b..8d0f00bc3ce 100644
--- a/qobject/block-qdict.c
+++ b/qobject/block-qdict.c
@@ -224,7 +224,6 @@ void qdict_array_split(QDict *src, QList **dst)
     for (i = 0; i < UINT_MAX; i++) {
         QObject *subqobj;
         bool is_subqdict;
-        QDict *subqdict;
         char indexstr[32], prefix[32];
         size_t snprintf_ret;

@@ -249,14 +248,16 @@ void qdict_array_split(QDict *src, QList **dst)
         }

         if (is_subqdict) {
+            QDict *subqdict = NULL;
+
             qdict_extract_subqdict(src, &subqdict, prefix);
             assert(qdict_size(subqdict) > 0);
+            qlist_append_obj(*dst, QOBJECT(subqdict));
         } else {
             qobject_ref(subqobj);
             qdict_del(src, indexstr);
+            qlist_append_obj(*dst, subqobj);
         }
-
-        qlist_append_obj(*dst, subqobj ?: QOBJECT(subqdict));
     }
 }
---

Anyhow,
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Cc'ing qemu-trivial@



  reply	other threads:[~2021-05-31  9:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-18 13:06 [PATCH] qobject: Fix maybe uninitialized in qdict_array_split Janosch Frank
2021-05-31  9:21 ` Janosch Frank
2021-05-31  9:44   ` Philippe Mathieu-Daudé [this message]
2021-05-31 10:13     ` Janosch Frank

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=97b11fa8-fd32-9f73-612b-dc4209e5b32e@redhat.com \
    --to=philmd@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).