* [PATCH] acpi/arm64: Adjust error handling procedure in gtdt_parse_timer_block()
@ 2024-08-27 10:12 Aleksandr Mishin
2024-08-29 13:52 ` Hanjun Guo
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Aleksandr Mishin @ 2024-08-27 10:12 UTC (permalink / raw)
To: Fu Wei
Cc: Aleksandr Mishin, Lorenzo Pieralisi, Hanjun Guo, Sudeep Holla,
Rafael J. Wysocki, Len Brown, Mark Rutland, linux-acpi,
linux-arm-kernel, linux-kernel, lvc-project
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--);
return -EINVAL;
}
--
2.30.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] acpi/arm64: Adjust error handling procedure in gtdt_parse_timer_block()
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
2024-08-29 16:17 ` Sudeep Holla
2024-11-08 16:49 ` Catalin Marinas
2 siblings, 0 replies; 6+ messages in thread
From: Hanjun Guo @ 2024-08-29 13:52 UTC (permalink / raw)
To: Aleksandr Mishin, Fu Wei
Cc: Lorenzo Pieralisi, Sudeep Holla, Rafael J. Wysocki, Len Brown,
Mark Rutland, linux-acpi, linux-arm-kernel, linux-kernel,
lvc-project
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] acpi/arm64: Adjust error handling procedure in gtdt_parse_timer_block()
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
@ 2024-08-29 16:17 ` Sudeep Holla
2024-08-29 16:24 ` Sudeep Holla
2024-11-08 16:49 ` Catalin Marinas
2 siblings, 1 reply; 6+ messages in thread
From: Sudeep Holla @ 2024-08-29 16:17 UTC (permalink / raw)
To: Aleksandr Mishin
Cc: Fu Wei, Lorenzo Pieralisi, Hanjun Guo, Rafael J. Wysocki,
Len Brown, Mark Rutland, linux-acpi, linux-arm-kernel,
linux-kernel, lvc-project
On Tue, Aug 27, 2024 at 01:12:39PM +0300, 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.
>
(For some reason I don't see the original email in my inbox, might have
got blocked 🙁). Anyways LGTM,
Acked-by: Aleksandr Mishin <amishin@t-argos.ru>
--
Regards,
Sudeep
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] acpi/arm64: Adjust error handling procedure in gtdt_parse_timer_block()
2024-08-29 16:17 ` Sudeep Holla
@ 2024-08-29 16:24 ` Sudeep Holla
2024-11-08 3:52 ` Hanjun Guo
0 siblings, 1 reply; 6+ messages in thread
From: Sudeep Holla @ 2024-08-29 16:24 UTC (permalink / raw)
To: Aleksandr Mishin
Cc: Fu Wei, Lorenzo Pieralisi, Hanjun Guo, Rafael J. Wysocki,
Len Brown, Mark Rutland, linux-acpi, linux-arm-kernel,
linux-kernel, lvc-project
On Thu, Aug 29, 2024 at 05:17:44PM +0100, Sudeep Holla wrote:
> On Tue, Aug 27, 2024 at 01:12:39PM +0300, 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.
> >
>
> (For some reason I don't see the original email in my inbox, might have
> got blocked 🙁). Anyways LGTM,
>
> Acked-by: Aleksandr Mishin <amishin@t-argos.ru>
Sorry I messed up, I meant
Acked-by: Sudeep Holla <sudeep.holla@arm.com>
--
Regards,
Sudeep
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] acpi/arm64: Adjust error handling procedure in gtdt_parse_timer_block()
2024-08-29 16:24 ` Sudeep Holla
@ 2024-11-08 3:52 ` Hanjun Guo
0 siblings, 0 replies; 6+ messages in thread
From: Hanjun Guo @ 2024-11-08 3:52 UTC (permalink / raw)
To: Sudeep Holla, Aleksandr Mishin
Cc: Catalin Marinas, Lorenzo Pieralisi, Rafael J. Wysocki, Len Brown,
Mark Rutland, linux-acpi, linux-arm-kernel, Will Deacon
+Cc Catalin and Will
On 2024/8/30 0:24, Sudeep Holla wrote:
> On Thu, Aug 29, 2024 at 05:17:44PM +0100, Sudeep Holla wrote:
>> On Tue, Aug 27, 2024 at 01:12:39PM +0300, 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.
>>>
>>
>> (For some reason I don't see the original email in my inbox, might have
>> got blocked 🙁). Anyways LGTM,
>>
>> Acked-by: Aleksandr Mishin <amishin@t-argos.ru>
>
> Sorry I messed up, I meant
>
> Acked-by: Sudeep Holla <sudeep.holla@arm.com>
Catalin, this is a fix, and was acked by Sudeep and me, could you
merge it for next release cycle?
Thanks
Hanjun
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] acpi/arm64: Adjust error handling procedure in gtdt_parse_timer_block()
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
2024-08-29 16:17 ` Sudeep Holla
@ 2024-11-08 16:49 ` Catalin Marinas
2 siblings, 0 replies; 6+ messages in thread
From: Catalin Marinas @ 2024-11-08 16:49 UTC (permalink / raw)
To: Fu Wei, Aleksandr Mishin
Cc: Will Deacon, Lorenzo Pieralisi, Hanjun Guo, Sudeep Holla,
Rafael J. Wysocki, Len Brown, Mark Rutland, linux-acpi,
linux-arm-kernel, linux-kernel, lvc-project
On Tue, 27 Aug 2024 13:12:39 +0300, 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.
>
> [...]
Applied to arm64 (for-next/misc), thanks!
[1/1] acpi/arm64: Adjust error handling procedure in gtdt_parse_timer_block()
https://git.kernel.org/arm64/c/1a9de2f6fda6
--
Catalin
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-11-08 17:10 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox