tools/testing: Check correct variable in open_procmap()
Subsystems (4)
PATCH 1/1 tools/testing: Check correct variable in open_procmap()
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 <[email protected]>
--- tools/testing/selftests/mm/vm_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/mm/vm_util.c +1 -1
@@ -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;
Signature · 1 line
2.47.2
Thanks so much for catching this Dan!
Quoted 2 lines · Dan Carpenter
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
Quoted 3 lines
Fixes bd23f293a0d5 ("tools/testing: add PROCMAP_QUERY helper functions in mm self tests")Signed-off-by Dan Carpenter <[email protected]>
Reviewed-by Lorenzo Stoakes <[email protected]>
Quoted 18 lines
--- tools/testing/selftests/mm/vm_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/testing/selftests/mm/vm_util.c +1
-2@@ -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; --
Quoted 2 lines
2.47.2
Cheers, Lorenzo