All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Zenghui Yu <yuzenghui@huawei.com>
Cc: elena.ufimtseva@oracle.com, john.g.johnson@oracle.com,
	jag.raman@oracle.com, qemu-trivial@nongnu.org,
	qemu-stable@nongnu.org, mjt@tls.msk.ru, qemu-devel@nongnu.org,
	laurent@vivier.eu, stefanha@redhat.com,
	wanghaibin.wang@huawei.com, berrange@redhat.com,
	philmd@redhat.com
Subject: Re: [PATCH v3] multi-process: Initialize variables declared with g_auto*
Date: Mon, 26 Apr 2021 14:30:51 +0100	[thread overview]
Message-ID: <YIbAi/3hOPLMi8LE@stefanha-x1.localdomain> (raw)
In-Reply-To: <d4a03c50-12db-f44c-7d6a-d2baba77f164@huawei.com>

[-- Attachment #1: Type: text/plain, Size: 2267 bytes --]

On Tue, Apr 06, 2021 at 10:00:03PM +0800, Zenghui Yu wrote:
> [+Stefan]
> 
> On 2021/3/12 19:21, 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 (using
> > gcc-7.3.0 on CentOS):
> > 
> > ../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;
> >                                ^~~~
> > 
> > Signed-off-by: Zenghui Yu <yuzenghui@huawei.com>
> > Reviewed-by: Jagannathan Raman <jag.raman@oracle.com>
> > Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> 
> Message-Id: <20210312112143.1369-1-yuzenghui@huawei.com>
> 
> Ping for 6.0, thanks.

I'm sorry I missed this email! QEMU 6.0.0-rc4 has already been tagged
and the final release is tomorrow. Only critical patches are applied at
this stage of the release process.

My understanding is that this patch silences a gcc 7.3.0 warning. The
warning is bogus since both code paths always initialize the variable.
You should still be able to compile successfully using ./configure
--disable-werror.

I guess this issue was hit on CentOS 7 since CentOS 8 ships a newer
version of gcc. Debian stable also ships a newer gcc. That probably
explains why this issue has not been encountered by others. I don't
think the patch is absolutely critical for QEMU 6.0 although I regret
not having merged it earlier in the release process. Sorry again.

I have queued this patch for QEMU 6.1 and CCed it for -stable for
inclusion in QEMU 6.0.1.

If you think this patch is critical for QEMU 6.0, please get in contact
with myself and Peter Maydel ("pm215"), preferrably on #qemu
irc.oftc.net IRC as soon as possible.

Thanks, applied to my block-next tree:
https://gitlab.com/stefanha/qemu/commits/block-next

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

      reply	other threads:[~2021-04-26 13:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-12 11:21 [PATCH v3] multi-process: Initialize variables declared with g_auto* Zenghui Yu
2021-03-12 13:54 ` Philippe Mathieu-Daudé
2021-03-15  5:48 ` Miroslav Rezanina
2021-03-15  6:20   ` Zenghui Yu
2021-03-15  6:32     ` Miroslav Rezanina
2021-04-06 14:00 ` Zenghui Yu
2021-04-26 13:30   ` Stefan Hajnoczi [this message]

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=YIbAi/3hOPLMi8LE@stefanha-x1.localdomain \
    --to=stefanha@gmail.com \
    --cc=berrange@redhat.com \
    --cc=elena.ufimtseva@oracle.com \
    --cc=jag.raman@oracle.com \
    --cc=john.g.johnson@oracle.com \
    --cc=laurent@vivier.eu \
    --cc=mjt@tls.msk.ru \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=stefanha@redhat.com \
    --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 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.