From patchwork Wed Oct 18 12:33:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 10014619 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 E5809601E7 for ; Wed, 18 Oct 2017 12:38:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D4D2328AAE for ; Wed, 18 Oct 2017 12:38:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C953A28B15; Wed, 18 Oct 2017 12:38:40 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, 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 586B728AAE for ; Wed, 18 Oct 2017 12:38:40 +0000 (UTC) Received: from localhost ([::1]:44445 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4ncN-0008Df-LH for patchwork-qemu-devel@patchwork.kernel.org; Wed, 18 Oct 2017 08:38:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58600) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4nXV-0005Cq-F7 for qemu-devel@nongnu.org; Wed, 18 Oct 2017 08:33:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e4nXU-0003wR-JL for qemu-devel@nongnu.org; Wed, 18 Oct 2017 08:33:37 -0400 Received: from mail-lf0-x243.google.com ([2a00:1450:4010:c07::243]:48470) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e4nXU-0003w8-BB for qemu-devel@nongnu.org; Wed, 18 Oct 2017 08:33:36 -0400 Received: by mail-lf0-x243.google.com with SMTP id a69so5627118lfe.5 for ; Wed, 18 Oct 2017 05:33:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/g52S3gQHjUWSaEKKe6eKfm3KBTEVMilKCG42SLZ9IY=; b=iolxd6KiEKBM1O8tzHZkMijJHN/TVPgv7cFZyCkhFSM1nghPKsHD/Bbjgm3EAtvQrE nMS+5ZgRI6Da7SkFhDumwf7A88IqusdUD7hyRauKMfvFJn9Eigyd9gv6gMrRrvhubmnW h0RmdMylsa76MixQg7gEgKzKST1YfdPVeC5Ic= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/g52S3gQHjUWSaEKKe6eKfm3KBTEVMilKCG42SLZ9IY=; b=OmDfzpnjRqkFJYx70WG3FbgvJzUyp4m5989H5BdE7zlAjcqZaKk168iyTfoNHE2x/i 3D6P8qVhdgDmjlBEzU8Pc7jmdC7z6mlTIa3xDjgHZMbYgNpHmgeV6nGuuJEC3XcoesY3 L8WVSvna5Q2ZsKtkb3vHISbDJVji6XmvImiO8vRfgQ3om5xmkAOx3Wr6mUBM3p4n6zax RskkY6nvsyGcvi/e9y5plt4vv03oONpeCj0a0ZPmTseFAnpnAoFbyvMF+qVOeqOdX8c9 wZUO7iwLjUZQc6bhJGHgjetkHt99HfdiW9zCECvM4vRQM3l+lzra2w01i2aWwKSNwc/e m0oA== X-Gm-Message-State: AMCzsaVaQc1r4N/yTIsWx9CcZQA4pHUupoEOePasTV/OGfI9v2aj5hqS J1gp/c30CEirWDFh9z3iKIeJ9JbZxdg= X-Google-Smtp-Source: ABhQp+RbptEvSMg1e3lkJogwcqnnEAbnuAfVR3XMUD4sxWU0XE2PuccvGye2VioRCm4bmxtpm11DeQ== X-Received: by 10.46.19.18 with SMTP id 18mr2630918ljt.141.1508330014639; Wed, 18 Oct 2017 05:33:34 -0700 (PDT) Received: from berserk.kos.to (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id j71sm2590718lfk.6.2017.10.18.05.33.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Oct 2017 05:33:33 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Wed, 18 Oct 2017 15:33:19 +0300 Message-Id: X-Mailer: git-send-email 2.14.2 In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::243 Subject: [Qemu-devel] [PULL 05/10] tcg: Fix off-by-one in assert in page_set_flags 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: Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Richard Henderson Most of the users of page_set_flags offset (page, page + len) as the end points. One might consider this an error, since the other users do supply an endpoint as the last byte of the region. However, the first thing that page_set_flags does is round end UP to the start of the next page. Which means computing page + len - 1 is in the end pointless. Therefore, accept this usage and do not assert when given the exact size of the vm as the endpoint. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20170708025030.15845-2-rth@twiddle.net> Signed-off-by: Riku Voipio --- accel/tcg/translate-all.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index c5ce99d549..1b43deb0cd 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -2114,7 +2114,7 @@ void page_set_flags(target_ulong start, target_ulong end, int flags) guest address space. If this assert fires, it probably indicates a missing call to h2g_valid. */ #if TARGET_ABI_BITS > L1_MAP_ADDR_SPACE_BITS - assert(end < ((target_ulong)1 << L1_MAP_ADDR_SPACE_BITS)); + assert(end <= ((target_ulong)1 << L1_MAP_ADDR_SPACE_BITS)); #endif assert(start < end); assert_memory_lock();