From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 844EE606A31E for ; Thu, 29 Oct 2026 08:13:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=X75aty7O; dkim=pass (1024-bit key, unprotected) header.d=huawei.com header.i=@huawei.com header.a=rsa-sha256 header.s=dkim header.b=k6m0K6oh DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:CC:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=sLX0dAXJtQCVkv3TbihTh8YXNXMoEZpgRUeoWcPA1mU=; b=X75aty7O1S4Ads Cc8r2phtyOn4zTsZVaJ/QtMF3DoZwGwNdX5F7rnLV/kPK2xLkR64uUV1q7zaV8X6jQjppRotY/Mqg kl1FHtsAF8XFRsWHOhJsl3kJZndWrR2ezFwLeAuu/J6wK6z8M2QW+zOns05QsiXKvq8gxome6QlXX i48uu0KUTz4C5IYlzIALH7l1f/fH47eRWT2h5Tznz9c+BtesPIgydHrhHaJLSLeIS3/CtmSepaJuL QrzdVWa9zxRJlWDSQRGSM41uyqDrIIc1nDAMOV44thdzYw3vjAYmdRaRrdeXR4Z6EipbR/4uWiZFL soXIbTAK6CrCZohvrcxw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xMLGO-00000008gl9-1PYi; Thu, 29 Oct 2026 08:13:32 +0000 Received: from canpmsgout02.his.huawei.com ([113.46.200.217]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xMLGK-00000008gkm-1sip for linux-arm-kernel@lists.infradead.org; Thu, 29 Oct 2026 08:13:30 +0000 dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=sLX0dAXJtQCVkv3TbihTh8YXNXMoEZpgRUeoWcPA1mU=; b=k6m0K6ohzROjiXTPxRaJoJPL5oH2Hj3XemhqYiI4XA4SQU1NV72L/nAHes80uhboCtMGZgHWQ smdX+5iu+6YQFynGMcWDbNcA0opjC8eYlohw0BjI/jzGN1BvdNh/GUqmmvR33VzPeG9DaYzaHWL plub0paio/oyi+lflNRVV+8= Received: from mail.maildlp.com (unknown [172.19.162.197]) by canpmsgout02.his.huawei.com (SkyGuard) with ESMTPS id 4jFcRh2830zcZyd; Thu, 29 Oct 2026 16:13:04 +0800 (CST) Received: from kwepemk200008.china.huawei.com (unknown [7.202.194.74]) by mail.maildlp.com (Postfix) with ESMTPS id DA7C24057D; Thu, 29 Oct 2026 16:13:19 +0800 (CST) Received: from [10.67.110.68] (10.67.110.68) by kwepemk200008.china.huawei.com (7.202.194.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.45; Thu, 29 Oct 2026 16:13:18 +0800 Message-ID: <83d3798d-99d3-4f0e-8552-c1d6492d6041@huawei.com> Date: Thu, 29 Oct 2026 16:13:18 +0800 X-Archived-By: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 2/6] arm_mpam: Fix MSC MMIO window size off-by-one with resource_size() To: Yin Li , James Morse , Rob Herring , Shanker Donthineni , Ben Horgan , Krzysztof Kozlowski , Conor Dooley , Catalin Marinas , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Reinette Chatre , Fenghua Yu , Jonathan Cameron , Bjorn Andersson , Konrad Dybcio , Gavin Shan CC: Andre Przywara , Drew Fustini , =?UTF-8?Q?Ilpo_J=C3=A4rvinen?= , Shaopeng Tan , , , , Srivathsa L Rao , Huang Yiwei , , , , , , kernel test robot References: <20261028-mpam-resctrl-dt-knp-support-v4-0-bdda1e445cba@oss.qualcomm.com> <20261028-mpam-resctrl-dt-knp-support-v4-2-bdda1e445cba@oss.qualcomm.com> From: Jinjie Ruan In-Reply-To: <20261028-mpam-resctrl-dt-knp-support-v4-2-bdda1e445cba@oss.qualcomm.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-ClientProxiedBy: kwepems500001.china.huawei.com (7.221.188.70) To kwepemk200008.china.huawei.com (7.202.194.74) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261029_011328_867029_BEA4B635 X-CRM114-Status: GOOD ( 19.63 ) X-Spam-Score: -2.1 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 在 2026/10/28 19:45, Yin Li 写道: > struct resource uses an inclusive end address, so the window size is > end - start + 1. do_mpam_msc_drv_probe() computed it as end - start, > which is one byte too small. > > mapped_hwpage_sz is used by the register access bounds checks, which > have the form "offset + width > mapped_hwpage_sz". With the size one > byte too small, an access to the last register in the window is > incorrectly flagged as out of bounds: for a 0x1000 window, a 4-byte > access at offset 0xFFC (bytes 0xFFC..0xFFF, legal) computes > 0xFFC + 4 = 0x1000 > 0xFFF and falsely warns. > > Use resource_size() so the size is correct. The ">" bounds checks are > correct as-is once the size is accurate and are left unchanged. > > Fixes: f04046f2577a ("arm_mpam: Add probe/remove for mpam msc driver and kbuild boiler plate") > Reported-by: kernel test robot > Closes: https://lore.kernel.org/oe-kbuild-all/202609030809.ObirDhR3-lkp@intel.com/ > Signed-off-by: Yin Li > Reviewed-by: Andre Przywara > Reviewed-by: Ben Horgan > --- > drivers/resctrl/mpam_devices.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/mpam_devices.c > index 347a5a6d6a1d..0f984fcbcae9 100644 > --- a/drivers/resctrl/mpam_devices.c > +++ b/drivers/resctrl/mpam_devices.c > @@ -2508,7 +2508,7 @@ static struct mpam_msc *do_mpam_msc_drv_probe(struct platform_device *pdev) > dev_err_once(dev, "Failed to map MSC base address\n"); > return ERR_CAST(io); > } > - msc->mapped_hwpage_sz = msc_res->end - msc_res->start; > + msc->mapped_hwpage_sz = resource_size(msc_res); Reviewed-by: Jinjie Ruan > msc->mapped_hwpage = io; > } else if (msc->iface == MPAM_IFACE_PCC) { > u32 mpam_fb_msc_id; > -- Best regards, Jinjie