lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YwTVRHXslU4aW52G@kernel.org>
Date:   Tue, 23 Aug 2022 16:25:24 +0300
From:   Mike Rapoport <rppt@...nel.org>
To:     Rebecca Mckeever <remckee0@...il.com>
Cc:     linux-mm@...ck.org, linux-kernel@...r.kernel.org,
        David Hildenbrand <david@...hat.com>,
        Shaoqin Huang <shaoqin.huang@...el.com>
Subject: Re: [PATCH v2 1/8] memblock tests: update tests to check if
 memblock_alloc zeroed memory

On Fri, Aug 19, 2022 at 01:34:49AM -0700, Rebecca Mckeever wrote:
> 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@...el.com>
> Signed-off-by: Rebecca Mckeever <remckee0@...il.com>
> ---
>  tools/testing/memblock/tests/alloc_api.c | 23 +++++++++++++++++++++++
>  tools/testing/memblock/tests/common.c    |  7 +++++++
>  tools/testing/memblock/tests/common.h    | 12 ++++++++++++
>  3 files changed, 42 insertions(+)
> 
> diff --git a/tools/testing/memblock/tests/alloc_api.c b/tools/testing/memblock/tests/alloc_api.c
> index a14f38eb8a89..aefb67557de9 100644
> --- a/tools/testing/memblock/tests/alloc_api.c
> +++ b/tools/testing/memblock/tests/alloc_api.c
> @@ -22,6 +22,8 @@ static int alloc_top_down_simple_check(void)
>  	allocated_ptr = memblock_alloc(size, SMP_CACHE_BYTES);
>  
>  	ASSERT_NE(allocated_ptr, NULL);
> +	ASSERT_MEM_EQ((char *)allocated_ptr, 0, size);
> +

Can we please hide the casting inside ASSERT_MEM_EQ()?

Like if ASSERT_MEM_EQ() were a function its declaration would be

bool ASSERT_MEM_EQ(void *mem, char val, size_t size);

>  	ASSERT_EQ(rgn->size, size);
>  	ASSERT_EQ(rgn->base, expected_start);
>  

-- 
Sincerely yours,
Mike.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ