From nobody Mon Feb 9 06:26:32 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1526799545753671.5576523414028; Sat, 19 May 2018 23:59:05 -0700 (PDT) Received: from localhost ([::1]:45432 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fKIJ6-0003lI-UB for importer@patchew.org; Sun, 20 May 2018 02:59:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47618) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fKIEY-0007pF-KF for qemu-devel@nongnu.org; Sun, 20 May 2018 02:54:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fKIEV-0002KG-K0 for qemu-devel@nongnu.org; Sun, 20 May 2018 02:54:22 -0400 Received: from isrv.corpit.ru ([86.62.121.231]:45493) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fKIEV-0002Jj-CL; Sun, 20 May 2018 02:54:19 -0400 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 3EBFB41129; Sun, 20 May 2018 09:54:18 +0300 (MSK) Received: from tls.msk.ru (mjt.vpn.tls.msk.ru [192.168.177.99]) by tsrv.corpit.ru (Postfix) with SMTP id EEBF510B4; Sun, 20 May 2018 09:15:12 +0300 (MSK) Received: (nullmailer pid 7408 invoked by uid 1000); Sun, 20 May 2018 06:15:12 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Date: Sun, 20 May 2018 09:15:04 +0300 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 86.62.121.231 Subject: [Qemu-devel] [PULL 18/22] replace functions which are only available in glib-2.24 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-trivial@nongnu.org, Olaf Hering , Michael Tokarev , qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Olaf Hering 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. Fixes commit 418026ca43 ("util: Introduce vfio helpers") Signed-off-by: Olaf Hering Reviewed-by: Thomas Huth Reviewed-by: Cornelia Huck Signed-off-by: Michael Tokarev CC: qemu-stable@nongnu.org --- 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..1d9272efa4 100644 --- a/util/vfio-helpers.c +++ b/util/vfio-helpers.c @@ -522,8 +522,7 @@ static IOVAMapping *qemu_vfio_add_mapping(QEMUVFIOState= *s, =20 assert(index >=3D 0); s->nr_mappings++; - s->mappings =3D g_realloc_n(s->mappings, sizeof(s->mappings[0]), - s->nr_mappings); + s->mappings =3D g_renew(IOVAMapping, s->mappings, s->nr_mappings); insert =3D &s->mappings[index]; shift =3D s->nr_mappings - index - 1; if (shift) { @@ -577,8 +576,7 @@ static void qemu_vfio_undo_mapping(QEMUVFIOState *s, IO= VAMapping *mapping, memmove(mapping, &s->mappings[index + 1], sizeof(s->mappings[0]) * (s->nr_mappings - index - 1)); s->nr_mappings--; - s->mappings =3D g_realloc_n(s->mappings, sizeof(s->mappings[0]), - s->nr_mappings); + s->mappings =3D g_renew(IOVAMapping, s->mappings, s->nr_mappings); } =20 /* Check if the mapping list is (ascending) ordered. */ --=20 2.11.0