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 DE09EC83F25 for ; Thu, 29 Aug 2024 13:54:07 +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:From:References:CC:To: Subject:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=tRcwmXTrgrvJ7B0qnhgw0JS3j2MqwPSq+mSCSePBobQ=; b=WJkRwI4zm43PAL98QRxdGihYDo 1CM7s9lRVVbLIgmAuZ9GAO4ocoOfbik3xAikhTJ1nTHNlElGrPwg/qqme+qNc0XmiLadDUCtSABzw 5Ke4ZkYRsQhCjvkrwV8JJhUDaBN9tG2zB9oIkgRxzTxxplCnnFqI7oR2T7WVR38OEM6adid7AXYHt upQAyxOCpb415NcZToBbCi2Gk9jbhPLSr8XKGvYpqLL3k4tAmPm8I0s/KbC4a3cPyPyrc2HLnTTqZ Z3rTZVOlHxHnJGEi5jOXCs2maP9ze71NCU7HvGWh2QeN2mgwWJzlvycoH2u+a03D2uF6cYr78t/Me yTHljacw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjfb3-00000002H5f-17v5; Thu, 29 Aug 2024 13:53:57 +0000 Received: from szxga07-in.huawei.com ([45.249.212.35]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjfaB-00000002Gsf-1Ocj for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2024 13:53:05 +0000 Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4WvjQW4Dzhz1S9FQ; Thu, 29 Aug 2024 21:52:35 +0800 (CST) Received: from dggpemf500002.china.huawei.com (unknown [7.185.36.57]) by mail.maildlp.com (Postfix) with ESMTPS id ED9EA140153; Thu, 29 Aug 2024 21:52:48 +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; Thu, 29 Aug 2024 21:52:48 +0800 Subject: Re: [PATCH] acpi/arm64: Adjust error handling procedure in gtdt_parse_timer_block() To: Aleksandr Mishin , Fu Wei CC: Lorenzo Pieralisi , Sudeep Holla , "Rafael J. Wysocki" , Len Brown , Mark Rutland , , , , References: <20240827101239.22020-1-amishin@t-argos.ru> From: Hanjun Guo Message-ID: <66f51691-db2b-5c1b-865f-a3ee708f670a@huawei.com> Date: Thu, 29 Aug 2024 21:52:47 +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: <20240827101239.22020-1-amishin@t-argos.ru> 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: dggems706-chm.china.huawei.com (10.3.19.183) 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-20240829_065304_351071_CA1EB231 X-CRM114-Status: GOOD ( 16.11 ) 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/8/27 18:12, Aleksandr Mishin wrote: > In case of error in gtdt_parse_timer_block() invalid 'gtdt_frame' > will be used in 'do {} while (i-- >= 0 && gtdt_frame--);' statement block > because do{} block will be executed even if 'i == 0'. > > Adjust error handling procedure by replacing 'i-- >= 0' with 'i-- > 0'. > > Found by Linux Verification Center (linuxtesting.org) with SVACE. > > Fixes: a712c3ed9b8a ("acpi/arm64: Add memory-mapped timer support in GTDT driver") > Signed-off-by: Aleksandr Mishin > --- > drivers/acpi/arm64/gtdt.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/acpi/arm64/gtdt.c b/drivers/acpi/arm64/gtdt.c > index c0e77c1c8e09..eb6c2d360387 100644 > --- a/drivers/acpi/arm64/gtdt.c > +++ b/drivers/acpi/arm64/gtdt.c > @@ -283,7 +283,7 @@ static int __init gtdt_parse_timer_block(struct acpi_gtdt_timer_block *block, > if (frame->virt_irq > 0) > acpi_unregister_gsi(gtdt_frame->virtual_timer_interrupt); > frame->virt_irq = 0; > - } while (i-- >= 0 && gtdt_frame--); > + } while (i-- > 0 && gtdt_frame--); Good catch, Acked-by: Hanjun Guo It's a fix in the error path, so I think it's OK for next release cycle. Thanks Hanjun