awokd@danwin1210.me has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38466 )
Change subject: vc/amd/agesa/f16kb/Proc/CPU: Avoid out-of-bounds read ......................................................................
Patch Set 2:
(2 comments)
https://review.coreboot.org/c/coreboot/+/38466/1/src/vendorcode/amd/agesa/f1... File src/vendorcode/amd/agesa/f16kb/Proc/CPU/Family/0x16/cpuF16MmioMap.c:
https://review.coreboot.org/c/coreboot/+/38466/1/src/vendorcode/amd/agesa/f1... PS1, Line 226: if (MmioPair >= (MMIO_REG_PAIR_NUM - 1)) {
Why not: MmmioPair > MMIO_REG_PAIR_NUM
I moved the `i` init further up to hopefully make more clear. Checking here to avoid attempt to read MmioRange[i + 1] inside the FOR loop, if program flow makes it here with MmioPair == 11. The `>` is probably superfluous (there should be no way to get here with an MmioPair > 11), but left it in since we're making a comparison anyway.
https://review.coreboot.org/c/coreboot/+/38466/1/src/vendorcode/amd/agesa/f1... PS1, Line 227: IDS_HDT_CONSOLE (MAIN_FLOW, " [ERROR] Not enough MMIO register pairs to hold the request.\n");
Please add the values to the error message.
Done