[PATCH] makedumpfile: When reading partial ELF pages, check final pointer against buffer end

Petr Tesarik ptesarik at suse.cz
Mon Feb 29 10:59:52 PST 2016


If the last part of a page is not present in the ELF file, it should
be replaced with zeroes. However, the check is incorrect.

Signed-off-by: Petr Tesarik <ptesarik at suse.com>

diff --git a/makedumpfile.c b/makedumpfile.c
index 867b953..138ddec 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -691,7 +691,7 @@ readpage_elf(unsigned long long paddr, void *bufptr)
 		ERRMSG("Attempt to read non-existent page at 0x%llx.\n",
 		       paddr);
 		return FALSE;
-	} else if (p < bufptr)
+	} else if (p < endp)
 		memset(p, 0, endp - p);
 
 	return TRUE;
@@ -744,7 +744,7 @@ readpage_elf_parallel(int fd_memory, unsigned long long paddr, void *bufptr)
 		ERRMSG("Attempt to read non-existent page at 0x%llx.\n",
 		       paddr);
 		return FALSE;
-	} else if (p < bufptr)
+	} else if (p < endp)
 		memset(p, 0, endp - p);
 
 	return TRUE;



More information about the kexec mailing list