From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E4626D3E1BC for ; Sat, 19 Oct 2024 07:37:15 +0000 (UTC) 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:MIME-Version:Date:Message-ID:References:CC:To:From: Subject:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=s6HPuS06MxbMg1nHRKNF0xxq34dmt2ZFGwdiEKqK/ho=; b=22FoBC9UwDJ+ZDiWFTMHqiA5d8 GgolzSMVY1L7MUMgEFrDbo+AbpFZBW0o6Iqc2+Wb0TgvoC4WZPG3saX3kWxw6hG4w+W2iaTtr8pc5 QU4VhS3FaZXQeXffDlxs6CFvJm1hf4ejqtva0ZVleOI4KvOexFvsjEZIoFGj31KQEckSECjgdayT7 tq+DiPysBmiPbpL5ytrQIZDH0m64iDdzUZqQ+NlOBSQA+FCeQswhCgfhHaZuww9xnRBOroTWSDnkt owRAUHsGl+8upU66pq308lgnBQct5uEW9DkqjTN19hmE96c7LG14RRrCWxM0pBRvs7KU6iuHJ815p tPY2f6FA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t241B-00000002jKV-3hu4; Sat, 19 Oct 2024 07:36:57 +0000 Received: from szxga01-in.huawei.com ([45.249.212.187]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t23zh-00000002jFv-3Ll0 for linux-arm-kernel@lists.infradead.org; Sat, 19 Oct 2024 07:35:28 +0000 Received: from mail.maildlp.com (unknown [172.19.163.48]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4XVtbv691vzySKF; Sat, 19 Oct 2024 15:33:47 +0800 (CST) Received: from dggpemf500002.china.huawei.com (unknown [7.185.36.57]) by mail.maildlp.com (Postfix) with ESMTPS id DED6F18009B; Sat, 19 Oct 2024 15:35:14 +0800 (CST) Received: from [10.174.178.247] (10.174.178.247) by dggpemf500002.china.huawei.com (7.185.36.57) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Sat, 19 Oct 2024 15:35:14 +0800 Subject: Re: [PATCH v4] ACPI: GTDT: Tighten the check for the array of platform timer structures From: Hanjun Guo To: Zheng Zengkai , , , , , , CC: , , , , References: <20241016095458.34126-1-zhengzengkai@huawei.com> Message-ID: <48e969ca-d43f-6d48-1b7e-7377086f8881@huawei.com> Date: Sat, 19 Oct 2024 15:35:13 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.178.247] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemf500002.china.huawei.com (7.185.36.57) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241019_003526_129635_86DDE448 X-CRM114-Status: GOOD ( 13.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2024/10/19 14:41, Hanjun Guo wrote: > On 2024/10/16 17:54, Zheng Zengkai wrote: >> As suggested by Marc and Lorenzo, first we need to check whether the >> platform_timer entry pointer is within gtdt bounds (< gtdt_end) before >> de-referencing what it points at to detect the length of the platform >> timer struct and then check that the length of current platform_timer >> struct is also valid, i.e. the length is not zero and within gtdt_end. >> Now next_platform_timer() only checks against gtdt_end for the entry of >> subsequent platform timer without checking the length of it and will >> not report error if the check failed and the existing check in function >> acpi_gtdt_init() is also not enough. >> >> Modify the for_each_platform_timer() iterator and use it combined with >> a dedicated check function platform_timer_valid() to do the check >> against table length (gtdt_end) for each element of platform timer >> array in function acpi_gtdt_init(), making sure that both their entry >> and length actually fit in the table. >> >> Suggested-by: Lorenzo Pieralisi >> Co-developed-by: Marc Zyngier >> Signed-off-by: Marc Zyngier > > Nit: since there is a "Co-developed-by:" for Marc, the > "Signed-off-by:" can be removed. Forget about this comment, the guide from submit patches needs the Signed-off-by:, sorry for the noise. Thanks Hanjun