From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58080) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z32MD-0000O9-HA for qemu-devel@nongnu.org; Thu, 11 Jun 2015 09:17:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z32Lz-0005Ed-1M for qemu-devel@nongnu.org; Thu, 11 Jun 2015 09:17:21 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:20723) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z32Ly-0005C4-0C for qemu-devel@nongnu.org; Thu, 11 Jun 2015 09:17:06 -0400 Message-ID: <55798A1A.6070001@huawei.com> Date: Thu, 11 Jun 2015 21:16:10 +0800 From: Gonglei MIME-Version: 1.0 References: <1434012280-23556-1-git-send-email-eric.auger@linaro.org> In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2] hw/vfio/platform: replace g_malloc0_n by g_new0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , Eric Auger Cc: Alex Williamson , eric.auger@st.com, QEMU Developers , Markus Armbruster On 2015/6/11 21:00, Peter Maydell wrote: > On 11 June 2015 at 09:44, 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 >> >> --- >> >> v1 -> v2: >> - replace g_malloc0 by g_new0 >> --- >> 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..9382bb7 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_new0(VFIORegion *, vbasedev->num_regions); >> >> for (i = 0; i < vbasedev->num_regions; i++) { >> struct vfio_region_info reg_info = { .argsz = sizeof(reg_info) }; >> -- >> 1.8.3.2 > > This looks like the right fix to me -- if somebody would like to > give it a reviewed-by tag I can apply it to master as a buildfix... > Yes, please. Reviewed-by: Gonglei