summaryrefslogtreecommitdiff
path: root/src/commonlib
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2020-12-03 12:25:11 -0800
committerJulius Werner <jwerner@chromium.org>2020-12-03 21:21:11 +0000
commit20f5dcec63ade1108e8ebaa6a34665aa9273db99 (patch)
tree347f30026aa92c1cda109a512236d4914ae86719 /src/commonlib
parentfdabf3fcd792e5939445233c74eb8bf3bb73de39 (diff)
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>
Diffstat (limited to 'src/commonlib')
-rw-r--r--src/commonlib/bsd/cbfs_mcache.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/commonlib/bsd/cbfs_mcache.c b/src/commonlib/bsd/cbfs_mcache.c
index d2f969dbc3..0d5d8e0221 100644
--- a/src/commonlib/bsd/cbfs_mcache.c
+++ b/src/commonlib/bsd/cbfs_mcache.c
@@ -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)