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] [day] [month] [year] [list]
Message-ID: <ffe62886-ddaa-4623-88d1-5ce1e6f3632e@redhat.com>
Date: Tue, 14 Jan 2025 11:21:16 +0100
From: David Hildenbrand <david@...hat.com>
To: liuye <liuye@...inos.cn>, akpm@...ux-foundation.org, shuah@...nel.org
Cc: linux-mm@...ck.org, linux-kselftest@...r.kernel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH] selftests/mm/mkdirty: Fix memory leak in
 test_uffdio_copy()

On 14.01.25 03:38, liuye wrote:
>      Release memory before exception branch returns to prevent memory leaks
> 
> Checking tools/testing/selftests/mm/mkdirty.c ...
> tools/testing/selftests/mm/mkdirty.c:283:3: error: Memory leak: src [memleak]
>    return;
>    ^

Don't take this the wrong way: there must be something better to be done 
with your time than fixing memory leaks on exit paths in tests.

> 
> Signed-off-by: liuye <liuye@...inos.cn>
> ---
>   tools/testing/selftests/mm/mkdirty.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/tools/testing/selftests/mm/mkdirty.c b/tools/testing/selftests/mm/mkdirty.c
> index 1db134063c38..af2fce496912 100644
> --- a/tools/testing/selftests/mm/mkdirty.c
> +++ b/tools/testing/selftests/mm/mkdirty.c
> @@ -280,6 +280,7 @@ static void test_uffdio_copy(void)
>   	dst = mmap(NULL, pagesize, PROT_READ, MAP_PRIVATE|MAP_ANON, -1, 0);
>   	if (dst == MAP_FAILED) {
>   		ksft_test_result_fail("mmap() failed\n");
> +		free(src);


We are immediately exiting the test afterwards ...

In any case, the change LGTM

Reviewed-by: David Hildenbrand <david@...hat.com>

-- 
Cheers,

David / dhildenb


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ