[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] qobject: Fix maybe uninitialized in qdict_array_split
From: |
Janosch Frank |
Subject: |
Re: [PATCH] qobject: Fix maybe uninitialized in qdict_array_split |
Date: |
Mon, 31 May 2021 12:13:47 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 |
On 5/31/21 11:44 AM, Philippe Mathieu-Daudé wrote:
> 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));
> }
> }
> ---
If you want post that snippet yourself, go ahead.
After all I only fixed a symptom without a closer look into the code.
>
> Anyhow,
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>
> Cc'ing qemu-trivial@
>
If not I'll take it, test on s390 and send a v2 with qemu-trivial and
you in CC.
Thanks for having a look!