qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>,
	"Zenghui Yu" <yuzenghui@huawei.com>,
	"Denis Plotnikov" <dplotnikov@virtuozzo.com>
Cc: elena.ufimtseva@oracle.com, john.g.johnson@oracle.com,
	jag.raman@oracle.com, qemu-devel@nongnu.org,
	wanghaibin.wang@huawei.com
Subject: Re: [PATCH] multi-process: Initialize variables declared with g_auto*
Date: Wed, 3 Mar 2021 11:26:13 +0100	[thread overview]
Message-ID: <b81b241d-a439-2ae3-58be-b2ce9be9d78e@redhat.com> (raw)
In-Reply-To: <YD9iTgCNgrsbzWfx@redhat.com>

On 3/3/21 11:17 AM, Daniel P. Berrangé wrote:
> On Wed, Mar 03, 2021 at 03:06:39PM +0800, Zenghui Yu wrote:
>> Quote docs/devel/style.rst (section "Automatic memory deallocation"):
>>
>> * Variables declared with g_auto* MUST always be initialized,
>>   otherwise the cleanup function will use uninitialized stack memory
>>
>> Initialize @name properly to get rid of the compilation error:
>>
>> ../hw/remote/proxy.c: In function 'pci_proxy_dev_realize':
>> /usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: error: 'name' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>>    g_free (*pp);
>>    ^~~~~~~~~~~~
>> ../hw/remote/proxy.c:350:30: note: 'name' was declared here
>>              g_autofree char *name;
>>                               ^~~~
> 
> This is a bit wierd.  There should only be risk of uninitialized
> variable if there is a 'return' or 'goto' statement between the
> variable declaration and and initialization, which is not the
> case in either scenario here.

See also commit 076b2fadb58 ("gdbstub: fix compiler complaining").

> 
> What OS distro and compiler + version are you seeing this with ?
> 
> Also we seem to be lacking any gitlab CI job to test with the
> multiprocess feature enabled
> 
> Regards,
> Daniel
> 



  reply	other threads:[~2021-03-03 10:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-03  7:06 [PATCH] multi-process: Initialize variables declared with g_auto* Zenghui Yu
2021-03-03  8:44 ` Jag Raman
2021-03-03 10:08 ` Philippe Mathieu-Daudé
2021-03-03 10:17 ` Daniel P. Berrangé
2021-03-03 10:26   ` Philippe Mathieu-Daudé [this message]
2021-03-03 14:24   ` Jag Raman
2021-03-03 14:26     ` Daniel P. Berrangé
2021-03-03 14:28       ` Jag Raman
2021-03-04  2:12   ` Zenghui Yu

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=b81b241d-a439-2ae3-58be-b2ce9be9d78e@redhat.com \
    --to=philmd@redhat.com \
    --cc=berrange@redhat.com \
    --cc=dplotnikov@virtuozzo.com \
    --cc=elena.ufimtseva@oracle.com \
    --cc=jag.raman@oracle.com \
    --cc=john.g.johnson@oracle.com \
    --cc=qemu-devel@nongnu.org \
    --cc=wanghaibin.wang@huawei.com \
    --cc=yuzenghui@huawei.com \
    /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).