[PATCH v2 3/4] init: free_initmem: poison freed init memory

From: Mike Rapoport
Date: Mon Feb 18 2019 - 13:44:05 EST


Various architectures including x86 poison the freed init memory.
Do the same in the generic free_initmem implementation and switch sparc32
architecture that is identical to the generic code over to it now.

Signed-off-by: Mike Rapoport <rppt@xxxxxxxxxxxxx>
---
arch/sparc/mm/init_32.c | 5 -----
init/main.c | 2 +-
2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c
index f0dbc0b..d02a9ae 100644
--- a/arch/sparc/mm/init_32.c
+++ b/arch/sparc/mm/init_32.c
@@ -294,11 +294,6 @@ void __init mem_init(void)
mem_init_print_info(NULL);
}

-void free_initmem (void)
-{
- free_initmem_default(POISON_FREE_INITMEM);
-}
-
void sparc_flush_page_to_ram(struct page *page)
{
unsigned long vaddr = (unsigned long)page_address(page);
diff --git a/init/main.c b/init/main.c
index 38d69e0..9a61e9c 100644
--- a/init/main.c
+++ b/init/main.c
@@ -1049,7 +1049,7 @@ static inline void mark_readonly(void)

void __weak free_initmem(void)
{
- free_initmem_default(-1);
+ free_initmem_default(POISON_FREE_INITMEM);
}

static int __ref kernel_init(void *unused)
--
2.7.4