summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/imd.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/lib/imd.c b/src/lib/imd.c
index 53d0616ab8..c86cf324c8 100644
--- a/src/lib/imd.c
+++ b/src/lib/imd.c
@@ -201,9 +201,8 @@ static int imdr_recover(struct imdr *imdr)
r = relative_pointer(rp, rp->root_offset);
- /* Confirm the root and root pointer are just under the limit. */
- if (ALIGN_UP((uintptr_t)&r->entries[r->max_entries], LIMIT_ALIGN) !=
- imdr->limit)
+ /* Ensure that root is just under the root pointer */
+ if ((intptr_t)rp - (intptr_t)&r->entries[r->max_entries] > sizeof(struct imd_entry))
return -1;
if (r->num_entries > r->max_entries)