mirror of
https://github.com/torvalds/linux.git
synced 2026-04-22 16:53:59 -04:00
memblock tests: update tests to check if memblock_alloc zeroed memory
Add an assert in memblock_alloc() tests where allocation is expected to occur. The assert checks whether the entire chunk of allocated memory is cleared. The current memblock_alloc() tests do not check whether the allocated memory was zeroed. memblock_alloc() should zero the allocated memory since it is a wrapper for memblock_alloc_try_nid(). Reviewed-by: Shaoqin Huang <shaoqin.huang@intel.com> Reviewed-by: David Hildenbrand <david@redhat.com> Signed-off-by: Rebecca Mckeever <remckee0@gmail.com> Signed-off-by: Mike Rapoport <rppt@linux.ibm.com> Link: https://lore.kernel.org/r/83ffb941b65074f40eb14552f8bfe5b71fe50abd.1661578349.git.remckee0@gmail.com
This commit is contained in:
committed by
Mike Rapoport
parent
61ebea2ba1
commit
ac76d803c4
@@ -60,16 +60,23 @@ void reset_memblock_attributes(void)
|
||||
memblock.current_limit = MEMBLOCK_ALLOC_ANYWHERE;
|
||||
}
|
||||
|
||||
static inline void fill_memblock(void)
|
||||
{
|
||||
memset(memory_block.base, 1, MEM_SIZE);
|
||||
}
|
||||
|
||||
void setup_memblock(void)
|
||||
{
|
||||
reset_memblock_regions();
|
||||
memblock_add((phys_addr_t)memory_block.base, MEM_SIZE);
|
||||
fill_memblock();
|
||||
}
|
||||
|
||||
void dummy_physical_memory_init(void)
|
||||
{
|
||||
memory_block.base = malloc(MEM_SIZE);
|
||||
assert(memory_block.base);
|
||||
fill_memblock();
|
||||
}
|
||||
|
||||
void dummy_physical_memory_cleanup(void)
|
||||
|
||||
Reference in New Issue
Block a user