From patchwork Sat Oct 8 08:58:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 9368077 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 5DA0B60487 for ; Sat, 8 Oct 2016 09:41:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 430D1299BC for ; Sat, 8 Oct 2016 09:41:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 30A6B299B3; Sat, 8 Oct 2016 09:41:51 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 9A7E0299B3 for ; Sat, 8 Oct 2016 09:41:50 +0000 (UTC) Received: from localhost ([::1]:40187 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bso8b-0002K3-9l for patchwork-qemu-devel@patchwork.kernel.org; Sat, 08 Oct 2016 05:41:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49782) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bso3x-000764-BG for qemu-devel@nongnu.org; Sat, 08 Oct 2016 05:37:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bso3v-0003Ml-0G for qemu-devel@nongnu.org; Sat, 08 Oct 2016 05:37:00 -0400 Received: from isrv.corpit.ru ([86.62.121.231]:44073) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bso3u-0003Km-PA; Sat, 08 Oct 2016 05:36:58 -0400 Received: from tsrv.tls.msk.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 3002140EDC; Sat, 8 Oct 2016 12:36:49 +0300 (MSK) Received: from tls.msk.ru (mjt.vpn.tls.msk.ru [192.168.177.99]) by tsrv.tls.msk.ru (Postfix) with SMTP id E5CB6B3E; Sat, 8 Oct 2016 11:58:16 +0300 (MSK) Received: (nullmailer pid 19258 invoked by uid 1000); Sat, 08 Oct 2016 08:58:14 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Date: Sat, 8 Oct 2016 11:58:04 +0300 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 86.62.121.231 Subject: [Qemu-devel] [PULL 18/26] 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?= , Michael Tokarev Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Marc-André Lureau 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 Signed-off-by: Michael Tokarev --- exec.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/exec.c b/exec.c index c8389f9..374c364 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); } }