fix: incorrect calculation for number of boot info desc
The calculation for maximum number of boot info descriptors that can be
fit in a boot info blob needs to account for memory necessary to
accommodate the boot information header.
Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
Change-Id: Ib1758cff0503aae34b5cdb992275d4ae4de20ca6
diff --git a/src/boot_info.c b/src/boot_info.c
index 89611ad..72f8746 100644
--- a/src/boot_info.c
+++ b/src/boot_info.c
@@ -99,7 +99,9 @@
(struct ffa_boot_info_header *)ptr_from_va(pkg_address);
const size_t boot_info_size = sp_pkg_get_boot_info_size(pkg_header);
const size_t max_boot_info_desc_count =
- boot_info_size / sizeof(struct ffa_boot_info_desc);
+ (boot_info_size -
+ offsetof(struct ffa_boot_info_header, boot_info)) /
+ sizeof(struct ffa_boot_info_desc);
assert(boot_info_node != NULL);
assert(pkg_header != NULL);