Commit 0f3d2bd5 authored by Jan Beulich's avatar Jan Beulich Committed by Linus Torvalds

[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: default avatarJan Beulich <jbeulich@novell.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent a1a5b3d9
......@@ -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 <linux/initrd.h>
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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment