(Note: Patch also attached because the inline version is certain to get line wrapped.) 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 <[email protected]> diff -Npru 2.6.13/init/initramfs.c 2.6.13-free-initrd/init/initramfs.c --- 2.6.13/init/initramfs.c 2005-08-29 01:41:01.000000000 +0200 +++ 2.6.13-free-initrd/init/initramfs.c 2005-04-29 08:51:21.000000000 +0200 @@ -466,6 +466,14 @@ static char * __init unpack_to_rootfs(ch extern char __initramfs_start[], __initramfs_end[]; #ifdef CONFIG_BLK_DEV_INITRD #include <linux/initrd.h> + +static inline 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
Attachment:
linux-2.6.13-free-initrd.patch
Description: Binary data
- Prev by Date: Re: [PATCH] minor ELF definitions addition
- Next by Date: Re: [PATCH] 3c59x: read current link status from phy
- Previous by thread: [PATCH] constify font data
- Next by thread: [PATCH] pass irq handling status down to low-level code
- Index(es):