diff options
| author | Heinrich Schuchardt <[email protected]> | 2023-03-31 15:15:15 +0200 |
|---|---|---|
| committer | Anup Patel <[email protected]> | 2023-04-07 11:22:25 +0530 |
| commit | 2868f26131308ff345382084681ea89c5b0159f1 (patch) | |
| tree | e937ec2141af932210e54973ef0fa384a5d2a8f3 | |
| parent | ee016a7bb098578a5d0d4bde01259fe3cd57b02f (diff) | |
lib: utils: fdt_fixup: avoid buffer overrun
fdt_reserved_memory_fixup() uses filtered_order[PMP_COUNT]. The index
must not reach PMP_COUNT.
Fixes: 199189bd1c17 ("lib: utils: Mark only the largest region as reserved in FDT")
Addresses-Coverity-ID: 1536994 ("Out-of-bounds write")
Signed-off-by: Heinrich Schuchardt <[email protected]>
Reviewed-by: Xiang W <[email protected]>
Reviewed-by: Anup Patel <[email protected]>
| -rw-r--r-- | lib/utils/fdt/fdt_fixup.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/utils/fdt/fdt_fixup.c b/lib/utils/fdt/fdt_fixup.c index c10179b9..ae6be008 100644 --- a/lib/utils/fdt/fdt_fixup.c +++ b/lib/utils/fdt/fdt_fixup.c @@ -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; |
