acpi/arm64: Adjust error handling procedure in gtdt_parse_timer_block()
[ Upstream commit1a9de2f6fd] 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:a712c3ed9b("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
bae56996ff
commit
c68110dee0
@@ -283,7 +283,7 @@ error:
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user