Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Shuah Khan <shuah@kernel.org>, Yeoreum Yun <yeoreum.yun@arm.com>,
	Wei Yang <richard.weiyang@gmail.com>,
	linux-mm@kvack.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH next] tools/testing: Check correct variable in open_procmap()
Date: Wed, 28 May 2025 10:46:07 +0100	[thread overview]
Message-ID: <2a5bb577-375f-4b97-8375-8639bcbb1144@lucifer.local> (raw)
In-Reply-To: <aDbFuUTlJTBqziVd@stanley.mountain>

Thanks so much for catching this Dan!

On Wed, May 28, 2025 at 11:13:45AM +0300, Dan Carpenter wrote:
> Check if "procmap_out->fd" is negative instead of "procmap_out" (which
> is a pointer).

Ye gods, so sorry for such a clanger! Entirely my fault, though I may mutter a
grumble about C type safety under my breath :P

>
> Fixes: bd23f293a0d5 ("tools/testing: add PROCMAP_QUERY helper functions in mm self tests")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>

> ---
>  tools/testing/selftests/mm/vm_util.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/mm/vm_util.c b/tools/testing/selftests/mm/vm_util.c
> index 1357e2d6a7b6..61d7bf1f8c62 100644
> --- a/tools/testing/selftests/mm/vm_util.c
> +++ b/tools/testing/selftests/mm/vm_util.c
> @@ -439,7 +439,7 @@ int open_procmap(pid_t pid, struct procmap_fd *procmap_out)
>  	sprintf(path, "/proc/%d/maps", pid);
>  	procmap_out->query.size = sizeof(procmap_out->query);
>  	procmap_out->fd = open(path, O_RDONLY);
> -	if (procmap_out < 0)
> +	if (procmap_out->fd < 0)
>  		ret = -errno;
>
>  	return ret;
> --
> 2.47.2
>

Cheers, Lorenzo

      reply	other threads:[~2025-05-28  9:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-28  8:13 [PATCH next] tools/testing: Check correct variable in open_procmap() Dan Carpenter
2025-05-28  9:46 ` Lorenzo Stoakes [this message]

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=2a5bb577-375f-4b97-8375-8639bcbb1144@lucifer.local \
    --to=lorenzo.stoakes@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=dan.carpenter@linaro.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=richard.weiyang@gmail.com \
    --cc=shuah@kernel.org \
    --cc=yeoreum.yun@arm.com \
    /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