From patchwork Mon Jul 23 20:17:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 948085 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="n6YGcnQ7"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41ZF7d1rl9z9s3Z for ; Tue, 24 Jul 2018 07:32:13 +1000 (AEST) Received: from localhost ([::1]:36799 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhiR8-00008K-Pb for incoming@patchwork.ozlabs.org; Mon, 23 Jul 2018 17:32:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43442) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhhL7-0004KG-P5 for qemu-devel@nongnu.org; Mon, 23 Jul 2018 16:21:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fhhL6-0005bb-Pv for qemu-devel@nongnu.org; Mon, 23 Jul 2018 16:21:53 -0400 Received: from mail-oi0-x235.google.com ([2607:f8b0:4003:c06::235]:34581) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fhhL6-0005aB-L0; Mon, 23 Jul 2018 16:21:52 -0400 Received: by mail-oi0-x235.google.com with SMTP id 13-v6so3512136ois.1; Mon, 23 Jul 2018 13:21:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=4SyDR+Kw4vS5a97h8bY2MM7EppQZY1jY1eIWeTlc2fc=; b=n6YGcnQ7ULlYVoMfSM4T04hiNzSTqYxH+A3V14rmkOODtqOc4XPTNHsgrRDmkYYc2Z ZBGfwUc8A+/4EyhIWYCO1AS7LieD82d3RmLB2kRrWMmTyGcf5qGHzgT/En3tmZdUsUun HaEKuU871sz9/HtTwIpFSnvD2xbgA2suUOXC0OXSNLXTsh2CHlQjA8ethDAmBlVaGyuP iOeicUtwr7zOdCAgjGsqqD6INTVAwXOhLpmFHD/skWAoNVEDLMc9mrliGtjsPevsEyQk IU3oubEcOHBMEACz7B9++tMSAiIPRm5U9EkYXYcHo6RFMRwso4q1mWf02L8TzRHKRjcY Czbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=4SyDR+Kw4vS5a97h8bY2MM7EppQZY1jY1eIWeTlc2fc=; b=soNR7IuFXvYnUokvTA6rzNCQ/hNi0BJdmQ4/I0Wqk8ePQ5CtlNyx53+SjL/NWfIAIe PRnyWQuPordd+XTfFgiB2cVAFBnjLLnqQJMTRIlYl/pUp27w4gMiH8YYGxXR+uoUWPG+ 7FBzlz5/4YfNAPel+e3E109CdteZUpcxDXK7CUKTcqTsd0Rffifp/t8r3YqmscJHgiif uqvuhioEhuUUYIH28j0XbxW6kgp8HHZ+k4DlimwmhQ9HziZ733JRJ/LYpf0AL/P9uehb qaFfI10UB1g5OoLQvwXfiAce37iHJpkfReGPBVa+WjKQmOOG46LivgrGergT/qAscBkM Mxvw== X-Gm-Message-State: AOUpUlFxqfNOjcRD4A91eqNkoH2Yl7f+hCHO3Z119WAlYdIl3o5eEW3G iXux1/syWl523lA2coKFSfEFTg4jkcqoiw== X-Google-Smtp-Source: AAOMgpduSZJX0piHRpqIAYQhCXbpIKiJgLizpfT+6Dm3e9VLkJql6vXLejs7oK//nJlJZJqrrSC1lg== X-Received: by 2002:aca:ea57:: with SMTP id i84-v6mr295050oih.266.1532377311430; Mon, 23 Jul 2018 13:21:51 -0700 (PDT) Received: from localhost (76-251-165-188.lightspeed.austtx.sbcglobal.net. [76.251.165.188]) by smtp.gmail.com with ESMTPSA id s142-v6sm8877489oie.48.2018.07.23.13.21.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Jul 2018 13:21:50 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Mon, 23 Jul 2018 15:17:38 -0500 Message-Id: <20180723201748.25573-90-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180723201748.25573-1-mdroth@linux.vnet.ibm.com> References: <20180723201748.25573-1-mdroth@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c06::235 Subject: [Qemu-devel] [PATCH 89/99] 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: Olaf Hering , Michael Tokarev , qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 (cherry picked from commit d29eb678bcfbb2fbf4b79423797253ee02f5c6cf) Signed-off-by: Michael Roth --- 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, 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); insert = &s->mappings[index]; shift = s->nr_mappings - index - 1; if (shift) { @@ -577,8 +576,7 @@ static void qemu_vfio_undo_mapping(QEMUVFIOState *s, IOVAMapping *mapping, memmove(mapping, &s->mappings[index + 1], sizeof(s->mappings[0]) * (s->nr_mappings - index - 1)); 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); } /* Check if the mapping list is (ascending) ordered. */