From patchwork Wed Apr 18 15:31:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olaf Hering X-Patchwork-Id: 10348407 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D9DFD6031B for ; Wed, 18 Apr 2018 15:36:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CBCBA28723 for ; Wed, 18 Apr 2018 15:36:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CA76E28735; Wed, 18 Apr 2018 15:36:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 81139289AE for ; Wed, 18 Apr 2018 15:34:04 +0000 (UTC) Received: from localhost ([::1]:34812 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f8p5v-0007wO-Ld for patchwork-qemu-devel@patchwork.kernel.org; Wed, 18 Apr 2018 11:34:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50748) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f8p3y-00076l-0m for qemu-devel@nongnu.org; Wed, 18 Apr 2018 11:32:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f8p3x-0008E1-98 for qemu-devel@nongnu.org; Wed, 18 Apr 2018 11:32:02 -0400 Received: from mo6-p01-ob.smtp.rzone.de ([2a01:238:20a:202:5301::3]:12484) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f8p3t-000891-2M; Wed, 18 Apr 2018 11:31:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1524065514; s=strato-dkim-0002; d=aepfle.de; h=Content-Type:References:In-Reply-To:Message-ID:Subject:Cc:To:From: Date:X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=aznttYjhnu4p0KLyvJcPoLjhAJkmHRLTyslUdOrSes8=; b=Iy1vUyNCJYPD85dlReYnzWLDX6ODFxmlC6H/oAhtUqXOm1kOuT+ohFb8WFANYiD60f 0Hvm/mGlVIRtrOFyvjHaCG/opUNleR5N8LWOmBHtcI53v7rx0jqAlSfvSeu0CjwhGrxF Bv5KRqSisJv94jA4PY3AbWMLFW/va2py9Pwph7eIgs14cd18Sl1LWEOUQoOM0iVBw/6U mZeudSSJbKJSg0jgJkKfAysuBheFgw6fRtKppIDkG+bqdbU+NjrYdWrLKmipeEwmls6O gVt0/sR71ss7acAaOS0b+J3uSjCP+6AUxb28qBLTxJy/z16bOEv67ZRHdcHG1X2x0f9L lc8w== X-RZG-AUTH: :P2EQZWCpfu+qG7CngxMFH1J+3q8wa/QED/SSGq+wjGiUC4oc0Nr2ihluivsBRtyRe2qcrldJj63vYUTRQR/0RqPSgWq+RVwc X-RZG-CLASS-ID: mo00 Received: from sender by smtp.strato.de (RZmta 43.4 AUTH) with ESMTPSA id Q05f37u3IFVq74Z (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Wed, 18 Apr 2018 17:31:52 +0200 (CEST) Date: Wed, 18 Apr 2018 17:31:47 +0200 From: Olaf Hering To: Eric Blake Message-ID: <20180418173147.07667af9.olaf@aepfle.de> In-Reply-To: <7df49e91-aa65-d775-78eb-ddf53676dd7f@redhat.com> References: <20180418145443.6332-1-olaf@aepfle.de> <7df49e91-aa65-d775-78eb-ddf53676dd7f@redhat.com> X-Mailer: Claws Mail 3.16.1 (GTK+ 2.24.32; x86_64-suse-linux-gnu) MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 2a01:238:20a:202:5301::3 Subject: Re: [Qemu-devel] [PATCH v2] configure: require glib-2.24 on Linux 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: Peter Maydell , Fam Zheng , qemu-trivial@nongnu.org, Philippe =?UTF-8?B?TWF0aGlldS1EYXVkw6k=?= , "open list:All patches CC here" , Gerd Hoffmann , Paolo Bonzini Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Am Wed, 18 Apr 2018 10:04:03 -0500 schrieb Eric Blake : > Rather than hacking configure, why not fix util/vfio-helpers.c to avoid > g_realloc_n()? We've done it before; see commit 071d405 I can not really test it, this variant may work: Olaf --- 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. */