The calculation of the starting PFN for exclusion in
exclude_nodata_pages() was rounding down, potentially excluding
the last valid page of a LOAD segment.

This commit fixes the issue by rounding up the calculated PFN to the
nearest page boundary, ensuring that the last valid page is included and
not erroneously excluded.

Signed-off-by: Ming Wang <wangmin...@loongson.cn>
---
 makedumpfile.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/makedumpfile.c b/makedumpfile.c
index 2fa67e7..b356eb3 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -5215,7 +5215,7 @@ exclude_nodata_pages(struct cycle *cycle)
                                   NULL, &file_size)) {
                unsigned long long pfn, pfn_end;
 
-               pfn = paddr_to_pfn(phys_start + file_size);
+               pfn = paddr_to_pfn(roundup(phys_start + file_size, PAGESIZE()));
                pfn_end = paddr_to_pfn(roundup(phys_end, PAGESIZE()));
 
                if (pfn < cycle->start_pfn)
-- 
2.39.2


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

Reply via email to