From 0f3d2bd54f8fb178f516fc6903366e16e20f7428 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Tue, 13 Sep 2005 01:25:12 -0700 Subject: [PATCH] free initrd mem adjustment Besides freeing initrd memory, also clear out the now dangling pointers to it, to make sure accidental late use attempts can be detected. Signed-off-by: Jan Beulich Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- init/initramfs.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'init/initramfs.c') diff --git a/init/initramfs.c b/init/initramfs.c index 02c5ce64990..0c5d9a3f951 100644 --- a/init/initramfs.c +++ b/init/initramfs.c @@ -466,6 +466,14 @@ static char * __init unpack_to_rootfs(char *buf, unsigned len, int check_only) extern char __initramfs_start[], __initramfs_end[]; #ifdef CONFIG_BLK_DEV_INITRD #include + +static void __init free_initrd(void) +{ + free_initrd_mem(initrd_start, initrd_end); + initrd_start = 0; + initrd_end = 0; +} + #endif void __init populate_rootfs(void) @@ -484,7 +492,7 @@ void __init populate_rootfs(void) printk(" it is\n"); unpack_to_rootfs((char *)initrd_start, initrd_end - initrd_start, 0); - free_initrd_mem(initrd_start, initrd_end); + free_initrd(); return; } printk("it isn't (%s); looks like an initrd\n", err); @@ -493,7 +501,7 @@ void __init populate_rootfs(void) sys_write(fd, (char *)initrd_start, initrd_end - initrd_start); sys_close(fd); - free_initrd_mem(initrd_start, initrd_end); + free_initrd(); } } #endif -- cgit v1.2.3-18-g5258