lib: utils: fdt_fixup: avoid buffer overrun
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Fri, 31 Mar 2023 13:15:15 +0000 (15:15 +0200)
committerAnup Patel <anup@brainfault.org>
Fri, 7 Apr 2023 05:52:25 +0000 (11:22 +0530)
commit2868f26131308ff345382084681ea89c5b0159f1
treee937ec2141af932210e54973ef0fa384a5d2a8f3
parentee016a7bb098578a5d0d4bde01259fe3cd57b02f
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 <heinrich.schuchardt@canonical.com>
Reviewed-by: Xiang W <wxjstz@126.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
lib/utils/fdt/fdt_fixup.c