linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Muhammad Usama Anjum <Usama.Anjum@collabora.com>
To: "Donet Tom" <donettom@linux.ibm.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Shuah Khan" <shuah@kernel.org>,
	"Jérôme Glisse" <jglisse@redhat.com>
Cc: Usama.Anjum@collabora.com, linux-mm@kvack.org,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	Ritesh Harjani <ritesh.list@gmail.com>,
	Kees Cook <keescook@chromium.org>,
	Mark Brown <broonie@kernel.org>,
	Przemek Kitszel <przemyslaw.kitszel@intel.com>
Subject: Re: [PATCH] selftests/mm: Fixed incorrect buffer->mirror size in hmm2 double_map test
Date: Fri, 27 Sep 2024 12:18:24 +0500	[thread overview]
Message-ID: <c62ee507-361b-4dc8-b80e-148c914052f1@collabora.com> (raw)
In-Reply-To: <20240927050752.51066-1-donettom@linux.ibm.com>

On 9/27/24 10:07 AM, Donet Tom wrote:
> The hmm2 double_map test was failing due to an incorrect
> buffer->mirror size. The buffer->mirror size was 6, while buffer->ptr
> size was 6 * PAGE_SIZE. The test failed because the kernel's
> copy_to_user function was attempting to copy a 6 * PAGE_SIZE buffer
> to buffer->mirror. Since the size of buffer->mirror was incorrect,
> copy_to_user failed.
> 
> This patch corrects the buffer->mirror size to 6 * PAGE_SIZE.
> 
> Test Result without this patch
> ==============================
>  #  RUN           hmm2.hmm2_device_private.double_map ...
>  # hmm-tests.c:1680:double_map:Expected ret (-14) == 0 (0)
>  # double_map: Test terminated by assertion
>  #          FAIL  hmm2.hmm2_device_private.double_map
>  not ok 53 hmm2.hmm2_device_private.double_map
> 
> Test Result with this patch
> ===========================
>  #  RUN           hmm2.hmm2_device_private.double_map ...
>  #            OK  hmm2.hmm2_device_private.double_map
>  ok 53 hmm2.hmm2_device_private.double_map
> 
> Signed-off-by: Donet Tom <donettom@linux.ibm.com>
Please add Fixes-by tag. Other than this, LGTM

Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com>

> ---
>  tools/testing/selftests/mm/hmm-tests.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/mm/hmm-tests.c b/tools/testing/selftests/mm/hmm-tests.c
> index d2cfc9b494a0..141bf63cbe05 100644
> --- a/tools/testing/selftests/mm/hmm-tests.c
> +++ b/tools/testing/selftests/mm/hmm-tests.c
> @@ -1657,7 +1657,7 @@ TEST_F(hmm2, double_map)
>  
>  	buffer->fd = -1;
>  	buffer->size = size;
> -	buffer->mirror = malloc(npages);
> +	buffer->mirror = malloc(size);
>  	ASSERT_NE(buffer->mirror, NULL);
>  
>  	/* Reserve a range of addresses. */

-- 
BR,
Muhammad Usama Anjum



  reply	other threads:[~2024-09-27  7:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-27  5:07 Donet Tom
2024-09-27  7:18 ` Muhammad Usama Anjum [this message]
2024-09-27 10:51   ` Donet Tom
2024-09-27 18:07     ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c62ee507-361b-4dc8-b80e-148c914052f1@collabora.com \
    --to=usama.anjum@collabora.com \
    --cc=akpm@linux-foundation.org \
    --cc=broonie@kernel.org \
    --cc=donettom@linux.ibm.com \
    --cc=jglisse@redhat.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=ritesh.list@gmail.com \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox