|
From: Paul F. <pa...@so...> - 2026-03-14 07:36:40
|
https://sourceware.org/cgit/valgrind/commit/?id=be2a8f98339abafb7b730964102e211c38529df1 commit be2a8f98339abafb7b730964102e211c38529df1 Author: Paul Floyd <pj...@wa...> Date: Sat Mar 14 08:26:59 2026 +0100 More consistent use of VG(strcmp) In e43f320b504a99edc45f1b5d0dce6fabde023b93 I silenced -Waddress warnings coming from VG_STREQ which does NULL pointer checks then calls VG_(strcmp). If the argument is a char array it can't be NULL. I changed using the macro to directly calling VG_(strcmp). In the same places there were still some uses of VG_STREQ and mixing macros and direct calls is confusing. It's safe to only make direct calls to VG_(strcmp) - the arguments are already checked or are string literals. Diff: --- coregrind/m_syswrap/syswrap-generic.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c index 3d31c53e72..85d584e4c9 100644 --- a/coregrind/m_syswrap/syswrap-generic.c +++ b/coregrind/m_syswrap/syswrap-generic.c @@ -4789,7 +4789,7 @@ static Bool handle_auxv_open(SyscallStatus *status, const HChar *filename, /* Opening /proc/<pid>/auxv or /proc/self/auxv? */ VG_(sprintf)(name, "/proc/%d/auxv", VG_(getpid)()); - if ((VG_(strcmp)(filename, name)!=0) && !VG_STREQ(filename, "/proc/self/auxv")) + if ((VG_(strcmp)(filename, name)!=0) && (VG_(strcmp)(filename, "/proc/self/auxv")!=0)) return False; /* Allow to open the file only for reading. */ @@ -4819,7 +4819,7 @@ static Bool handle_self_exe_open(SyscallStatus *status, const HChar *filename, /* Opening /proc/<pid>/exe or /proc/self/exe? */ VG_(sprintf)(name, "/proc/%d/exe", VG_(getpid)()); - if ((VG_(strcmp)(filename, name)!=0) && !VG_STREQ(filename, "/proc/self/exe")) + if ((VG_(strcmp)(filename, name)!=0) && (VG_(strcmp)(filename, "/proc/self/exe")!=0)) return False; /* Allow to open the file only for reading. */ @@ -4910,7 +4910,7 @@ PRE(sys_open) VG_(sprintf)(name, "/proc/%d/cmdline", VG_(getpid)()); if (ML_(safe_to_deref)( arg1s, 1 ) - && (VG_(strcmp)(arg1s, name)==0 || VG_STREQ(arg1s, "/proc/self/cmdline"))) { + && (VG_(strcmp)(arg1s, name)==0 || VG_(strcmp)(arg1s, "/proc/self/cmdline")==0)) { sres = VG_(dup)( VG_(cl_cmdline_fd) ); SET_STATUS_from_SysRes( sres ); if (!sr_isError(sres)) { @@ -5094,7 +5094,7 @@ PRE(sys_readlink) HChar* arg1s = (HChar*) (Addr)ARG1; VG_(sprintf)(name, PID_EXEPATH, VG_(getpid)()); if (ML_(safe_to_deref)(arg1s, 1) - && (VG_(strcmp)(arg1s, name)==0 || VG_STREQ(arg1s, SELF_EXEPATH))) { + && (VG_(strcmp)(arg1s, name)==0 || VG_(strcmp)(arg1s, SELF_EXEPATH)==0)) { HChar* out_name = (HChar*)ARG2; SizeT res = VG_(strlen)(VG_(resolved_exename)); res = VG_MIN(res, ARG3); |