From: Juan Quintela <quintela@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
"Cédric Le Goater" <clg@kaod.org>,
qemu-devel <qemu-devel@nongnu.org>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Thomas Huth" <thuth@redhat.com>,
"Daniel Henrique Barboza" <danielhb413@gmail.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Cédric Le Goater" <clg@redhat.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>
Subject: Re: [PATCH] async: Suppress GCC13 false positive in aio_bh_poll()
Date: Fri, 28 Apr 2023 18:24:17 +0200 [thread overview]
Message-ID: <87v8hg9dqm.fsf@secure.mitica> (raw)
In-Reply-To: <CABgObfY1ZmfRGjVnsQ6NC7jTe_X+Gx4uxW4R048xxaJ3Vdt+9A@mail.gmail.com> (Paolo Bonzini's message of "Fri, 28 Apr 2023 16:26:01 +0200")
Paolo Bonzini <pbonzini@redhat.com> wrote:
> Il mar 25 apr 2023, 15:31 Daniel P. Berrangé <berrange@redhat.com> ha
> scritto:
>
>> > > - BHListSlice slice;
>> > > + /*
>> > > + * gcc13 complains about putting a local variable
>> > > + * in a global list, so put it on the heap.
>> > > + */
>> > > + g_autofree BHListSlice *slice = g_new(BHListSlice, 1);
>> > > BHListSlice *s;
>> > > int ret = 0;
>> > >
>> >
>> > This must be a memory leak since you're adding a g_new but not
>> > adding any g_free
>>
>> Sorry, I'm failing to read properly today. It uses g_autofree
>> so there is no leak.
>>
>
> On the other hand, if the pointer to the heap-allocated BHListSlice
> escaped, this would be a dangling pointer as well—just not the kind that
> the new GCC warning can report.
I don't agree here.
If with my patch it becomes a dangling pointer because we free it.
With Cedric patch it is a local variable that gets exited out of the
function that created it.
Choose your poison. One thing is bad and the other is worse.
> So this patch is also doing nothing but shut up the compiler; but it's
> doing so in an underhanded manner and with a runtime cost, and as such it's
> worse than Cedric's patch.
Ok. I don't care (enogouh) about this to continue a discussion.. Can we
get Cedric patch upstream?
Thanks, Juan.
next prev parent reply other threads:[~2023-04-28 16:24 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-20 20:29 [PATCH] async: Suppress GCC13 false positive in aio_bh_poll() Cédric Le Goater
2023-04-20 20:36 ` Cédric Le Goater
2023-04-20 21:07 ` Daniel Henrique Barboza
2023-04-20 21:28 ` Daniel Henrique Barboza
2023-04-21 6:08 ` Philippe Mathieu-Daudé
2023-04-22 14:06 ` Stefan Hajnoczi
2023-04-24 6:33 ` Thomas Huth
2023-04-24 6:54 ` Cédric Le Goater
2023-04-25 13:22 ` Juan Quintela
2023-04-25 13:24 ` Daniel P. Berrangé
2023-04-25 13:30 ` Daniel P. Berrangé
2023-04-28 14:26 ` Paolo Bonzini
2023-04-28 16:24 ` Juan Quintela [this message]
2023-04-28 16:55 ` Paolo Bonzini
2023-04-28 10:55 ` Paolo Bonzini
2023-05-17 6:35 ` Thomas Huth
2023-05-17 6:54 ` Michael Tokarev
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=87v8hg9dqm.fsf@secure.mitica \
--to=quintela@redhat.com \
--cc=berrange@redhat.com \
--cc=clg@kaod.org \
--cc=clg@redhat.com \
--cc=danielhb413@gmail.com \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=thuth@redhat.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).