
From: Ernie Petrides <petrides@redhat.com>

While investigating the 2.4 memory corruption problem fixed by the patch
previously posted, it was noticed that the 2.6 version of get_kcore_size()
inappropriately uses sizeof(struct memelfnote) in its calculation of the
/proc/kcore ELF header size.  What is actually stored in the header is an
"elf_note" structure plus the 4 ASCII chars "CORE".

It just so happens that on 32-bit arches, both calculations result in the
same value (16).  But on 64-bit arches, the allocated size (24) is larger
than necessary (16).  This does not result in any possible data corruption,
but it might be nice to correct this "conceptual" error.

Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/fs/proc/kcore.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -puN fs/proc/kcore.c~minor-conceptual-fix-for-proc-kcore-header-size fs/proc/kcore.c
--- 25/fs/proc/kcore.c~minor-conceptual-fix-for-proc-kcore-header-size	2005-03-07 20:41:38.000000000 -0800
+++ 25-akpm/fs/proc/kcore.c	2005-03-07 20:41:38.000000000 -0800
@@ -84,7 +84,7 @@ static size_t get_kcore_size(int *nphdr,
 	}
 	*elf_buflen =	sizeof(struct elfhdr) + 
 			(*nphdr + 2)*sizeof(struct elf_phdr) + 
-			3 * sizeof(struct memelfnote) +
+			3 * (sizeof(struct elf_note) + 4) +
 			sizeof(struct elf_prstatus) +
 			sizeof(struct elf_prpsinfo) +
 			sizeof(struct task_struct);
_
