init: free_initmem: poison freed init memory
authorMike Rapoport <rppt@linux.ibm.com>
Tue, 14 May 2019 00:18:46 +0000 (17:18 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 14 May 2019 16:47:47 +0000 (09:47 -0700)
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.

Link: http://lkml.kernel.org/r/1550515285-17446-4-git-send-email-rppt@linux.ibm.com
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Palmer Dabbelt <palmer@sifive.com>
Cc: Richard Kuo <rkuo@codeaurora.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/sparc/mm/init_32.c
init/main.c

index 417f89d5e0b206e920e0fecd01fdf159cff748e9..046ab116cc8c6ecc2deeff6d26c0cd9624b0d626 100644 (file)
@@ -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);
index 26234570a32455d6751ecdfe2ad5ecb549ce9a05..5a2c69b4d7b3ac040f45eb0b2922bfcd7d2ab832 100644 (file)
@@ -1076,7 +1076,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)