[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f3c0e925-4f71-4051-9f13-57169f1be960@arm.com>
Date: Tue, 11 Mar 2025 10:23:34 +0530
From: Dev Jain <dev.jain@....com>
To: Cyan Yang <cyan.yang@...ive.com>, akpm@...ux-foundation.org,
shuah@...nel.org, david@...hat.com
Cc: linux-mm@...ck.org, linux-kselftest@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] selftests/mm/cow: Fix the incorrect error handling
On 11/03/25 8:07 am, Cyan Yang wrote:
> There are two error handlings did not check the correct return value.
> This patch will fix them.
>
> Fixes: f4b5fd6946e244cdedc3bbb9a1f24c8133b2077a ("selftests/vm: anon_cow: THP tests")
> Signed-off-by: Cyan Yang <cyan.yang@...ive.com>
> ---
> tools/testing/selftests/mm/cow.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/mm/cow.c b/tools/testing/selftests/mm/cow.c
> index 9446673645eb..16fcadc090a4 100644
> --- a/tools/testing/selftests/mm/cow.c
> +++ b/tools/testing/selftests/mm/cow.c
> @@ -876,13 +876,13 @@ static void do_run_with_thp(test_fn fn, enum thp_run thp_run, size_t thpsize)
> mremap_size = thpsize / 2;
> mremap_mem = mmap(NULL, mremap_size, PROT_NONE,
> MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
> - if (mem == MAP_FAILED) {
> + if (mremap_mem == MAP_FAILED) {
> ksft_test_result_fail("mmap() failed\n");
> goto munmap;
> }
> tmp = mremap(mem + mremap_size, mremap_size, mremap_size,
> MREMAP_MAYMOVE | MREMAP_FIXED, mremap_mem);
> - if (tmp != mremap_mem) {
This is fine. We are checking whether we were able to mremap tmp to
mremap_mem.
> + if (tmp == MAP_FAILED) {
> ksft_test_result_fail("mremap() failed\n");
> goto munmap;
> }
Powered by blists - more mailing lists