cbfs: mcache: Fix end-of-cache check

After the mcache is copied into CBMEM, it has *just* the right size to
fit the final tag with no room to spare. That means the test to check if
we walked over the end must be `current + sizeof(tag) <= end`, not
`current + sizeof(tag) < end`.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Change-Id: I25a0d774fb3294bb4d15f31f432940bfccc84af0
Reviewed-on: https://review.coreboot.org/c/coreboot/+/48277
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
This commit is contained in:
Julius Werner 2020-12-03 12:25:11 -08:00
parent fdabf3fcd7
commit 20f5dcec63
1 changed files with 1 additions and 1 deletions

View File

@ -95,7 +95,7 @@ cb_err_t cbfs_mcache_lookup(const void *mcache, size_t mcache_size, const char *
const void *end = mcache + mcache_size;
const void *current = mcache;
while (current + sizeof(uint32_t) < end) {
while (current + sizeof(uint32_t) <= end) {
const union mcache_entry *entry = current;
if (entry->magic == MCACHE_MAGIC_END)