From: Dan Carpenter Date: Wed, 28 May 2025 08:13:45 +0000 (+0300) Subject: tools/testing: check correct variable in open_procmap() X-Git-Tag: v6.16-rc1~73^2~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=83da212b7fca407f6f30c7d6f02a8f910db8724d;p=thirdparty%2Flinux.git tools/testing: check correct variable in open_procmap() Check if "procmap_out->fd" is negative instead of "procmap_out" (which is a pointer). Link: https://lkml.kernel.org/r/aDbFuUTlJTBqziVd@stanley.mountain Fixes: bd23f293a0d5 ("tools/testing: add PROCMAP_QUERY helper functions in mm self tests") Signed-off-by: Dan Carpenter Reviewed-by: Lorenzo Stoakes Cc: levi.yun Cc: Shuah Khan Cc: Wei Yang Signed-off-by: Andrew Morton --- diff --git a/tools/testing/selftests/mm/vm_util.c b/tools/testing/selftests/mm/vm_util.c index 1357e2d6a7b68..61d7bf1f8c62f 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;