From: Eric Auger <eric.auger@linaro.org>
To: Gonglei <arei.gonglei@huawei.com>,
eric.auger@st.com, qemu-devel@nongnu.org,
alex.williamson@redhat.com, peter.maydell@linaro.org
Subject: Re: [Qemu-devel] [PATCH] hw/vfio/platform: replace g_malloc0_n by g_malloc0
Date: Thu, 11 Jun 2015 10:46:00 +0200 [thread overview]
Message-ID: <55794AC8.20602@linaro.org> (raw)
In-Reply-To: <55793F0C.3080403@huawei.com>
Hi Gonglei,
On 06/11/2015 09:55 AM, Gonglei wrote:
> On 2015/6/11 15:14, Eric Auger wrote:
>> g_malloc0_n() is introduced since glib-2.24 while QEMU currently
>> requires glib-2.22. This may cause a link error on some distributions.
>>
>> Signed-off-by: Eric Auger <eric.auger@linaro.org>
>> ---
>> hw/vfio/platform.c | 3 +--
>> 1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/hw/vfio/platform.c b/hw/vfio/platform.c
>> index 35266a8..c0acc8b 100644
>> --- a/hw/vfio/platform.c
>> +++ b/hw/vfio/platform.c
>> @@ -346,8 +346,7 @@ static int vfio_populate_device(VFIODevice *vbasedev)
>> return ret;
>> }
>>
>> - vdev->regions = g_malloc0_n(vbasedev->num_regions,
>> - sizeof(VFIORegion *));
>> + vdev->regions = g_malloc0(vbasedev->num_regions * sizeof(VFIORegion *));
>>
>
> Why not use g_new0() which returned pointer is cast to the given type?
Looks relevant indeed.
g_malloc0 is used in similar situations in rest of the VFIO code so I
posted a new version and let Alex choose among both.
Thanks
Eric
>
> Regards,
> -Gonglei
>> for (i = 0; i < vbasedev->num_regions; i++) {
>> struct vfio_region_info reg_info = { .argsz = sizeof(reg_info) };
>>
>
>
next prev parent reply other threads:[~2015-06-11 8:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-11 7:14 [Qemu-devel] [PATCH] hw/vfio/platform: replace g_malloc0_n by g_malloc0 Eric Auger
2015-06-11 7:55 ` Gonglei
2015-06-11 8:46 ` Eric Auger [this message]
2015-06-11 11:11 ` Markus Armbruster
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=55794AC8.20602@linaro.org \
--to=eric.auger@linaro.org \
--cc=alex.williamson@redhat.com \
--cc=arei.gonglei@huawei.com \
--cc=eric.auger@st.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/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).