Skip to content

Commit 1a9de2f

Browse files
Aleksandr Mishinctmarinas
authored andcommitted
acpi/arm64: Adjust error handling procedure in gtdt_parse_timer_block()
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: a712c3e ("acpi/arm64: Add memory-mapped timer support in GTDT driver") Signed-off-by: Aleksandr Mishin <amishin@t-argos.ru> Acked-by: Hanjun Guo <guohanjun@huawei.com> Acked-by: Sudeep Holla <sudeep.holla@arm.com> Acked-by: Aleksandr Mishin <amishin@t-argos.ru> Link: https://lore.kernel.org/r/20240827101239.22020-1-amishin@t-argos.ru Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent 340fd66 commit 1a9de2f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/acpi/arm64/gtdt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ static int __init gtdt_parse_timer_block(struct acpi_gtdt_timer_block *block,
294294
if (frame->virt_irq > 0)
295295
acpi_unregister_gsi(gtdt_frame->virtual_timer_interrupt);
296296
frame->virt_irq = 0;
297-
} while (i-- >= 0 && gtdt_frame--);
297+
} while (i-- > 0 && gtdt_frame--);
298298

299299
return -EINVAL;
300300
}

0 commit comments

Comments
 (0)