From: Thomas Huth <thuth@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
Olaf Hering <olaf@aepfle.de>
Cc: qemu-trivial@nongnu.org, Fam Zheng <famz@redhat.com>,
"open list:All patches CC here" <qemu-devel@nongnu.org>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] replace functions which are only available in glib-2.24
Date: Tue, 15 May 2018 15:38:53 +0200 [thread overview]
Message-ID: <27f1e01f-4f06-4cd7-d546-f9654c706be4@redhat.com> (raw)
In-Reply-To: <7c3cb275-1568-ee34-314e-c3400b8148c2@redhat.com>
On 15.05.2018 10:41, Paolo Bonzini wrote:
> On 15/05/2018 09:42, Markus Armbruster wrote:
>> Olaf Hering <olaf@aepfle.de> writes:
>>
>>> Currently the minimal supported version of glib is 2.22.
>>> Since testing is done with a glib that claims to be 2.22, but in fact
>>> has APIs from newer version of glib, this bug was not caught during
>>> submit of the patch referenced below.
>>>
>>> Replace g_realloc_n, which is available only since 2.24, with g_renew.
>>
>> We're about to bump our required GLib version to 2.34. See
>> https://lists.gnu.org/archive/html/qemu-devel/2018-05/msg02562.html
>> Message-ID: <751a3b4f-55ef-dec0-aec9-6b48922b7843@redhat.com>
>>
>> However, the patch may make sense for stable anyway.
>
> It's a good idea even for non-stable. In the end, g_*alloc*_n are
> rarely needed, and almost always g_*new* is better as it provides better
> type safety. I'm queuing the patch, and we should consider adding a
> checkpatch rule to suggest not using these functions.
Please do not queue this version of the patch - Olaf sent a v2 where he
fixed the obvious bug with "IOVAMapping *" vs. "IOVAMapping".
> Paolo
>
>>> Fixes commit 418026ca43 ("util: Introduce vfio helpers")
>>>
>>> Signed-off-by: Olaf Hering <olaf@aepfle.de>
>>> ---
>>>
>>> This must go into stable-2.12.
>>
>> Please see docs/devel/stable-process.rst for how to get a patch into a
>> stable release.
>>
>>> util/vfio-helpers.c | 6 ++----
>>> 1 file changed, 2 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/util/vfio-helpers.c b/util/vfio-helpers.c
>>> index 006674c916..5fd4f5f212 100644
>>> --- a/util/vfio-helpers.c
>>> +++ b/util/vfio-helpers.c
>>> @@ -522,8 +522,7 @@ static IOVAMapping *qemu_vfio_add_mapping(QEMUVFIOState *s,
>>>
>>> assert(index >= 0);
>>> s->nr_mappings++;
>>> - s->mappings = g_realloc_n(s->mappings, sizeof(s->mappings[0]),
>>> - s->nr_mappings);
>>> + s->mappings = g_renew(IOVAMapping *, s->mappings, s->nr_mappings);
>>
>> I'm afraid this switches from allocating a bunch of IOVAMapping to a
>> bunch of IOVAMapping *. My gcc duly warns.
See v2 of the patch where Olaf fixed this already.
Thomas
prev parent reply other threads:[~2018-05-15 13:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-15 5:59 [Qemu-devel] [PATCH] replace functions which are only available in glib-2.24 Olaf Hering
2018-05-15 6:04 ` no-reply
2018-05-15 6:28 ` Olaf Hering
2018-05-15 7:42 ` Markus Armbruster
2018-05-15 8:41 ` Paolo Bonzini
2018-05-15 13:38 ` Thomas Huth [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=27f1e01f-4f06-4cd7-d546-f9654c706be4@redhat.com \
--to=thuth@redhat.com \
--cc=armbru@redhat.com \
--cc=famz@redhat.com \
--cc=olaf@aepfle.de \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=stefanha@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).