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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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;



[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux