From patchwork Wed Sep 28 12:37:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 676185 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3skckp0mcYz9s2Q for ; Wed, 28 Sep 2016 22:41:06 +1000 (AEST) Received: from localhost ([::1]:58493 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpEAY-0004xY-Qk for incoming@patchwork.ozlabs.org; Wed, 28 Sep 2016 08:41:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52958) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpE7C-0001YD-Cs for qemu-devel@nongnu.org; Wed, 28 Sep 2016 08:37:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bpE78-0006cu-7Q for qemu-devel@nongnu.org; Wed, 28 Sep 2016 08:37:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53838) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpE78-0006bP-1J; Wed, 28 Sep 2016 08:37:30 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AA51431B321; Wed, 28 Sep 2016 12:37:28 +0000 (UTC) Received: from localhost (ovpn-116-77.phx2.redhat.com [10.3.116.77]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u8SCbQZd020884; Wed, 28 Sep 2016 08:37:27 -0400 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 28 Sep 2016 16:37:20 +0400 Message-Id: <20160928123720.21171-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 28 Sep 2016 12:37:28 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] exec: remove unused compacted argument 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, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , mst@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Since commit b35ba30f8f when it was introduced, phys_page_compact() takes an unused compacted argument. ubsan complains about it when launching qemu-x86_64 without arguments: qemu/exec.c:310:5: runtime error: variable length array bound evaluates to non-positive value 0 Signed-off-by: Marc-André Lureau --- exec.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/exec.c b/exec.c index c81d5ab..fc7e902 100644 --- a/exec.c +++ b/exec.c @@ -255,7 +255,7 @@ static void phys_page_set(AddressSpaceDispatch *d, /* Compact a non leaf page entry. Simply detect that the entry has a single child, * and update our entry so we can skip it and go directly to the destination. */ -static void phys_page_compact(PhysPageEntry *lp, Node *nodes, unsigned long *compacted) +static void phys_page_compact(PhysPageEntry *lp, Node *nodes) { unsigned valid_ptr = P_L2_SIZE; int valid = 0; @@ -275,7 +275,7 @@ static void phys_page_compact(PhysPageEntry *lp, Node *nodes, unsigned long *com valid_ptr = i; valid++; if (p[i].skip) { - phys_page_compact(&p[i], nodes, compacted); + phys_page_compact(&p[i], nodes); } } @@ -307,10 +307,8 @@ static void phys_page_compact(PhysPageEntry *lp, Node *nodes, unsigned long *com static void phys_page_compact_all(AddressSpaceDispatch *d, int nodes_nb) { - DECLARE_BITMAP(compacted, nodes_nb); - if (d->phys_map.skip) { - phys_page_compact(&d->phys_map, d->map.nodes, compacted); + phys_page_compact(&d->phys_map, d->map.nodes); } }