mirror of
https://github.com/Fishwaldo/opensbi.git
synced 2025-03-15 19:31:32 +00:00
lib: utils: fdt_fixup: avoid buffer overrun
fdt_reserved_memory_fixup() uses filtered_order[PMP_COUNT]. The index
must not reach PMP_COUNT.
Fixes: 199189bd1c
("lib: utils: Mark only the largest region as reserved in FDT")
Addresses-Coverity-ID: 1536994 ("Out-of-bounds write")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Xiang W <wxjstz@126.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
parent
ee016a7bb0
commit
2868f26131
1 changed files with 1 additions and 1 deletions
|
@ -355,7 +355,7 @@ int fdt_reserved_memory_fixup(void *fdt)
|
|||
if (reg->flags & SBI_DOMAIN_MEMREGION_SU_EXECUTABLE)
|
||||
continue;
|
||||
|
||||
if (i > PMP_COUNT) {
|
||||
if (i >= PMP_COUNT) {
|
||||
sbi_printf("%s: Too many memory regions to fixup.\n",
|
||||
__func__);
|
||||
return SBI_ENOSPC;
|
||||
|
|
Loading…
Add table
Reference in a new issue