fastboot: fix header_actual calculation
Bug: 77920157
Test: fastboot boot $OUT/kernel
Change-Id: Ibe2f4b9a6476ac11937448e6547b5159af011633
Merged-In: Ibe2f4b9a6476ac11937448e6547b5159af011633
Signed-off-by: Fernando Lugo <flugo@google.com>
(cherry picked from commit 91dfaecca7db64689c2f572b72d838d70a638093)
diff --git a/fastboot/bootimg_utils.cpp b/fastboot/bootimg_utils.cpp
index 23443ec..2e8c334 100644
--- a/fastboot/bootimg_utils.cpp
+++ b/fastboot/bootimg_utils.cpp
@@ -45,7 +45,7 @@
off_t tags_offset, uint32_t header_version, int64_t* bootimg_size) {
size_t page_mask = page_size - 1;
- int64_t header_actual = sizeof(boot_img_hdr_v1) & (~page_mask);
+ int64_t header_actual = (sizeof(boot_img_hdr_v1) + page_mask) & (~page_mask);
int64_t kernel_actual = (kernel_size + page_mask) & (~page_mask);
int64_t ramdisk_actual = (ramdisk_size + page_mask) & (~page_mask);
int64_t second_actual = (second_size + page_mask) & (~page_mask);