From patchwork Tue Jul 18 20:02:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 9849463 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 9099C60392 for ; Tue, 18 Jul 2017 20:17:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C53A285CC for ; Tue, 18 Jul 2017 20:17:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 60F85285E3; Tue, 18 Jul 2017 20:17: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=-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 E36E2285CC for ; Tue, 18 Jul 2017 20:17:26 +0000 (UTC) Received: from localhost ([::1]:58407 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXYvu-00023W-5e for patchwork-qemu-devel@patchwork.kernel.org; Tue, 18 Jul 2017 16:17:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50139) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXYjb-00070E-3d for qemu-devel@nongnu.org; Tue, 18 Jul 2017 16:04:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dXYja-0005EA-9T for qemu-devel@nongnu.org; Tue, 18 Jul 2017 16:04:43 -0400 Received: from mail-qt0-x242.google.com ([2607:f8b0:400d:c0d::242]:33402) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dXYja-0005Dw-5B for qemu-devel@nongnu.org; Tue, 18 Jul 2017 16:04:42 -0400 Received: by mail-qt0-x242.google.com with SMTP id 50so2614215qtz.0 for ; Tue, 18 Jul 2017 13:04:42 -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 :mime-version:content-transfer-encoding; bh=jBEpTo9AdAY/BTifvhRtPnAgW+y3yge1c/epYnp7it8=; b=KpYn8AZYHrgjXqAkQs/khqIonDNANwmQKHZmKAC0jraQgctbJo/3ub1G+I16lTboZ+ u1Xcs7jA0emmG3ArYueA0yiQD5Cu1jxU1ybaQR7gNX8w/IXvHCtfhCSQQLLlroYjNUEa ls4LRV1K2OQ99yuyRKGvmpJZoDIM/19eBC9O/+SgWe+8CLmUloXeD1XYczz4kRYe31QJ LdT1Z8HRXYsDFQWuDDFpiH8TypnTcOsf2Spqy8vqCDE8IfybBuZKplWIF14mLiU8gC44 m9GpMzWvYB+QyYOtmJXRkM4PrsmHA02KLR6VC9u5yESs8rPTvf2xjAL+xYk/yhts2wbZ 5YOQ== 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:mime-version:content-transfer-encoding; bh=jBEpTo9AdAY/BTifvhRtPnAgW+y3yge1c/epYnp7it8=; b=Fa5eQ5YyGMW+mgmhzI+web6gAKvL3H8DM775GKKgx0p/Ses4LHi6WOClUhrVX0B9Vm upuZkdfYIqsRkIPgzJ2Bp5jmdjtdswLDm4aVk5w7CWOwpybZ1vOVjb1Porm8x9zmaP/M XCC3WPjyf8tTzyt5XcuuF8yfrIENppZqYHkt9Gp7TDyoBnXFKROlkZbS/7s9g92e53EQ eo1fLpykxPg4VOSsvGSAbvAlJjDruDTEIow7ToZnc6ZHWs0FL1VGgYf3aHd1Id0mqqAG xUaQr5ytUdUpAPBEJU49EXBdRLQ7ILoGmcPsBLIwvr9afKXVw/bxPZiQjk/pvkkh/4Fr 4zpw== X-Gm-Message-State: AIVw112QbyX7AFaBKASU3OCOQmxUkAKLkAHNcuu9pKh2LHFTsAI/ml1M WUNYdeXVLi+TI0fuGvU= X-Received: by 10.237.42.44 with SMTP id c41mr4345821qtd.74.1500408281318; Tue, 18 Jul 2017 13:04:41 -0700 (PDT) Received: from bigtime.com ([101.165.234.197]) by smtp.gmail.com with ESMTPSA id b201sm2339817qkg.5.2017.07.18.13.04.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Jul 2017 13:04:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 18 Jul 2017 10:02:53 -1000 Message-Id: <20170718200255.31647-29-rth@twiddle.net> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170718200255.31647-1-rth@twiddle.net> References: <20170718200255.31647-1-rth@twiddle.net> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::242 Subject: [Qemu-devel] [PATCH v3 28/30] 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: aurelien@aurel32.net Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- 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 4e1831c..f304ee1 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -2063,7 +2063,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();