aboutsummaryrefslogtreecommitdiff
path: root/tools/testing/memblock/tests/alloc_helpers_api.c
diff options
context:
space:
mode:
authorRebecca Mckeever <[email protected]>2022-08-27 00:42:44 -0500
committerMike Rapoport <[email protected]>2022-08-30 13:12:00 +0300
commit25b9defb5bc4aee8beb51ded07838e12745426f9 (patch)
treeaaf0f117c63c337a1c02b10365e2e45e98918ce1 /tools/testing/memblock/tests/alloc_helpers_api.c
parentac76d803c4f6c2a32c9c7436d14467e099fd2bfa (diff)
memblock tests: update zeroed memory check for memblock_alloc_* tests
Update the assert in memblock_alloc_try_nid() and memblock_alloc_from() tests that checks whether the memory is cleared so that it checks the entire chunk of allocated memory instead of just the first byte. Reviewed-by: David Hildenbrand <[email protected]> Reviewed-by: Shaoqin Huang <[email protected]> Signed-off-by: Rebecca Mckeever <[email protected]> Signed-off-by: Mike Rapoport <[email protected]> Link: https://lore.kernel.org/r/24b3271751756100142e65b75284d43b4d30c9b7.1661578349.git.remckee0@gmail.com
Diffstat (limited to 'tools/testing/memblock/tests/alloc_helpers_api.c')
-rw-r--r--tools/testing/memblock/tests/alloc_helpers_api.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/tools/testing/memblock/tests/alloc_helpers_api.c b/tools/testing/memblock/tests/alloc_helpers_api.c
index 1069b4bdd5fd..f1c7d6f170b6 100644
--- a/tools/testing/memblock/tests/alloc_helpers_api.c
+++ b/tools/testing/memblock/tests/alloc_helpers_api.c
@@ -19,7 +19,6 @@ static int alloc_from_simple_generic_check(void)
{
struct memblock_region *rgn = &memblock.reserved.regions[0];
void *allocated_ptr = NULL;
- char *b;
PREFIX_PUSH();
@@ -31,10 +30,9 @@ static int alloc_from_simple_generic_check(void)
min_addr = memblock_end_of_DRAM() - SMP_CACHE_BYTES;
allocated_ptr = memblock_alloc_from(size, SMP_CACHE_BYTES, min_addr);
- b = (char *)allocated_ptr;
ASSERT_NE(allocated_ptr, NULL);
- ASSERT_EQ(*b, 0);
+ ASSERT_MEM_EQ(allocated_ptr, 0, size);
ASSERT_EQ(rgn->size, size);
ASSERT_EQ(rgn->base, min_addr);
@@ -66,7 +64,6 @@ static int alloc_from_misaligned_generic_check(void)
{
struct memblock_region *rgn = &memblock.reserved.regions[0];
void *allocated_ptr = NULL;
- char *b;
PREFIX_PUSH();
@@ -79,10 +76,9 @@ static int alloc_from_misaligned_generic_check(void)
min_addr = memblock_end_of_DRAM() - (SMP_CACHE_BYTES * 2 - 1);
allocated_ptr = memblock_alloc_from(size, SMP_CACHE_BYTES, min_addr);
- b = (char *)allocated_ptr;
ASSERT_NE(allocated_ptr, NULL);
- ASSERT_EQ(*b, 0);
+ ASSERT_MEM_EQ(allocated_ptr, 0, size);
ASSERT_EQ(rgn->size, size);
ASSERT_EQ(rgn->base, memblock_end_of_DRAM() - SMP_CACHE_BYTES);