From: Albert Cahalan <albert@users.sourceforge.net>

It's not OK to leak bits of the kernel stack.
(tiny security flaw) I found this with -Wpadded.



 25-akpm/fs/stat.c               |    1 +
 25-akpm/include/asm-i386/stat.h |    1 +
 2 files changed, 2 insertions(+)

diff -puN fs/stat.c~stack-leak-fix fs/stat.c
--- 25/fs/stat.c~stack-leak-fix	Thu Jul 17 16:47:03 2003
+++ 25-akpm/fs/stat.c	Thu Jul 17 16:47:03 2003
@@ -123,6 +123,7 @@ static int cp_old_stat(struct kstat *sta
 	SET_OLDSTAT_UID(tmp, stat->uid);
 	SET_OLDSTAT_GID(tmp, stat->gid);
 	tmp.st_rdev = stat->rdev;
+	tmp.__pad_16bit = 0;  /* don't leak kernel stack data! */
 #if BITS_PER_LONG == 32
 	if (stat->size > MAX_NON_LFS)
 		return -EOVERFLOW;
diff -puN include/asm-i386/stat.h~stack-leak-fix include/asm-i386/stat.h
--- 25/include/asm-i386/stat.h~stack-leak-fix	Thu Jul 17 16:47:03 2003
+++ 25-akpm/include/asm-i386/stat.h	Thu Jul 17 16:47:03 2003
@@ -9,6 +9,7 @@ struct __old_kernel_stat {
 	unsigned short st_uid;
 	unsigned short st_gid;
 	unsigned short st_rdev;
+	unsigned short __pad_16bit;
 	unsigned long  st_size;
 	unsigned long  st_atime;
 	unsigned long  st_mtime;

_