public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Hanjun Guo <guohanjun@huawei.com>
To: Aleksandr Mishin <amishin@t-argos.ru>, Fu Wei <fu.wei@linaro.org>
Cc: Lorenzo Pieralisi <lpieralisi@kernel.org>,
	Sudeep Holla <sudeep.holla@arm.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Len Brown <lenb@kernel.org>, Mark Rutland <mark.rutland@arm.com>,
	<linux-acpi@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <lvc-project@linuxtesting.org>
Subject: Re: [PATCH] acpi/arm64: Adjust error handling procedure in gtdt_parse_timer_block()
Date: Thu, 29 Aug 2024 21:52:47 +0800	[thread overview]
Message-ID: <66f51691-db2b-5c1b-865f-a3ee708f670a@huawei.com> (raw)
In-Reply-To: <20240827101239.22020-1-amishin@t-argos.ru>

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 <amishin@t-argos.ru>
> ---
>   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 <guohanjun@huawei.com>

It's a fix in the error path, so I think it's OK for next release cycle.

Thanks
Hanjun


  reply	other threads:[~2024-08-29 13:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-27 10:12 [PATCH] acpi/arm64: Adjust error handling procedure in gtdt_parse_timer_block() Aleksandr Mishin
2024-08-29 13:52 ` Hanjun Guo [this message]
2024-08-29 16:17 ` Sudeep Holla
2024-08-29 16:24   ` Sudeep Holla
2024-11-08  3:52     ` Hanjun Guo
2024-11-08 16:49 ` Catalin Marinas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=66f51691-db2b-5c1b-865f-a3ee708f670a@huawei.com \
    --to=guohanjun@huawei.com \
    --cc=amishin@t-argos.ru \
    --cc=fu.wei@linaro.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=mark.rutland@arm.com \
    --cc=rafael@kernel.org \
    --cc=sudeep.holla@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox