Skip to content

Commit b476e29

Browse files
JoonsooKimtorvalds
authored andcommitted
mm, nobootmem: do memset() after memblock_reserve()
Currently, we do memset() before reserving the area. This may not cause any problem, but it is somewhat weird. So change execution order. Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com> Cc: Yinghai Lu <yinghai@kernel.org> Acked-by: Johannes Weiner <hannes@cmpxchg.org> Cc: Jiang Liu <liuj97@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent b4def35 commit b476e29

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mm/nobootmem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ static void * __init __alloc_memory_core_early(int nid, u64 size, u64 align,
4545
if (!addr)
4646
return NULL;
4747

48+
memblock_reserve(addr, size);
4849
ptr = phys_to_virt(addr);
4950
memset(ptr, 0, size);
50-
memblock_reserve(addr, size);
5151
/*
5252
* The min_count is set to 0 so that bootmem allocated blocks
5353
* are never reported as leaks.

0 commit comments

Comments
 (0)