linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH next] tools/testing: Check correct variable in open_procmap()
@ 2025-05-28  8:13 Dan Carpenter
  2025-05-28  9:46 ` Lorenzo Stoakes
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2025-05-28  8:13 UTC (permalink / raw)
  To: Lorenzo Stoakes
  Cc: Andrew Morton, Shuah Khan, Yeoreum Yun, Wei Yang, linux-mm,
	linux-kselftest, linux-kernel, kernel-janitors

Check if "procmap_out->fd" is negative instead of "procmap_out" (which
is a pointer).

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



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH next] tools/testing: Check correct variable in open_procmap()
  2025-05-28  8:13 [PATCH next] tools/testing: Check correct variable in open_procmap() Dan Carpenter
@ 2025-05-28  9:46 ` Lorenzo Stoakes
  0 siblings, 0 replies; 2+ messages in thread
From: Lorenzo Stoakes @ 2025-05-28  9:46 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Andrew Morton, Shuah Khan, Yeoreum Yun, Wei Yang, linux-mm,
	linux-kselftest, linux-kernel, kernel-janitors

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-05-28  9:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox