From nobody Tue Feb 10 15:45:32 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15468804015290.5594474806221115; Mon, 7 Jan 2019 09:00:01 -0800 (PST) Received: from localhost ([127.0.0.1]:49143 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ggYFh-0001xo-Hf for importer@patchew.org; Mon, 07 Jan 2019 11:59:49 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46811) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ggXpT-0005lt-Gy for qemu-devel@nongnu.org; Mon, 07 Jan 2019 11:32:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ggXpR-0003Jt-Bx for qemu-devel@nongnu.org; Mon, 07 Jan 2019 11:32:43 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:34557) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ggXpP-0002Ya-9X for qemu-devel@nongnu.org; Mon, 07 Jan 2019 11:32:41 -0500 Received: by mail-wm1-x330.google.com with SMTP id y185so6501230wmd.1 for ; Mon, 07 Jan 2019 08:32:05 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id j14sm46039759wrv.96.2019.01.07.08.32.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 07 Jan 2019 08:32:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=sV9hC86VR1BwwXtur8ugDHh5zaLnT6kGUvr9DsHA44A=; b=MRmnZ7//wQxNBmlC1nh8DnVtqFq7gX27iH08KtlUOK8UaBzZFMmGd2gCleuVaPfm2h Spxernas4aGlf4LESatRr2E7Sr51wvEfdw1xXIBiOdHWy8XRTb+Y0+45l4S7J7/9LxLb ePbejMTlvxYUn5Kuw9L9IVZ1Vx8wOOb92FF9U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sV9hC86VR1BwwXtur8ugDHh5zaLnT6kGUvr9DsHA44A=; b=Z2s1JD1WnSkcHE4fXZIC9g6MrUmFaM5lCLm+fy8FaZN81eBTILa3ZgyblK9KatnBNW J8DEspuDan0W3B3ZZrmC4TRYUseeTGY+SITLhtKBixjRBfa2YjJPXvJr5nIq0bTp6+9Y hch2CaEbfD5EpTDHnYp28JNTBUmEESsT3m7ztW3gXRz8Cvrl2FupwK676i+kA6gXBHuD DLErXZs+5gV7Boz52TmKw78ilcK/+TjCQx8NC6o7Hc58dTZ0lAmRHVT0eLeGbxMLLIRf paQWSEfKNsaGjHzevgLt4EaMBYN4UdlyPL/2Zz07sI0+vU5iadw2VJ0PZTeSvUtwPAfC HDBQ== X-Gm-Message-State: AJcUukeMIURQ8flPwQh/htlPQ1IYgaVJCoNUrUN/IX9XavLfElEvfqwv 3WQG/Q/KiolR9mXErBMm+98pTHCANs8XUQ== X-Google-Smtp-Source: ALg8bN4dnYdbSXANEgEoNMVvzgP072QhoIjLsJUlYFi2li9VGtct6Iu4MB7H+BKVJA6xiqikUxuR+g== X-Received: by 2002:a1c:4c10:: with SMTP id z16mr9666886wmf.117.1546878724629; Mon, 07 Jan 2019 08:32:04 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 7 Jan 2019 16:31:16 +0000 Message-Id: <20190107163117.16269-37-peter.maydell@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20190107163117.16269-1-peter.maydell@linaro.org> References: <20190107163117.16269-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::330 Subject: [Qemu-devel] [PULL 36/37] hw/misc/tz-mpc: Fix value of BLK_MAX register 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" In the TZ Memory Protection Controller, the BLK_MAX register is supposed to return the maximum permitted value of the BLK_IDX register. Our implementation incorrectly returned max+1 (ie the total number of valid index values, since BLK_IDX is zero-based). Correct this off-by-one error. Since we consistently initialize and use s->blk_max throughout the implementation as the 'size' of the LUT, just adjust the value we return when the guest reads the BLK_MAX register, rather than trying to change the semantics of the s->blk_max internal struct field. Fixes: https://bugs.launchpad.net/qemu/+bug/1806824 Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-id: 20181213183249.3468-1-peter.maydell@linaro.org --- hw/misc/tz-mpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/misc/tz-mpc.c b/hw/misc/tz-mpc.c index fb48a1540b9..9a84be75ed6 100644 --- a/hw/misc/tz-mpc.c +++ b/hw/misc/tz-mpc.c @@ -150,7 +150,7 @@ static MemTxResult tz_mpc_reg_read(void *opaque, hwaddr= addr, r =3D s->ctrl; break; case A_BLK_MAX: - r =3D s->blk_max; + r =3D s->blk_max - 1; break; case A_BLK_CFG: /* We are never in "init in progress state", so this just indicates --=20 2.19.2