]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
FreeBSD syscall wrapper: fix warning
authorPaul Floyd <pjfloyd@wanadoo.fr>
Mon, 13 Oct 2025 07:18:18 +0000 (09:18 +0200)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Mon, 13 Oct 2025 07:18:18 +0000 (09:18 +0200)
Was giving
m_syswrap/syswrap-main.c:370:28: warning: variable 'saved' is uninitialized when passed as a const pointer argument here [-Wuninitialized-const-pointer]
  370 |             syscall_mask, &saved, sizeof(vki_sigset_t)
      |                            ^~~~~

Initialising it is probably the safest thing to do, but I suspect that the
argument ought not to be const. Will check on that.

While I'm at it, looking at how Solaris handles the carry flag it's much
better than the global variable used by FreeBSD and Darwin. Will check on
that as well.

coregrind/m_syswrap/syswrap-main.c

index 5919698f0efad14f99c41edf4a001154ffb2b4f2..424d0a08a3cede71d89b8723dcd55a326647ed86 100644 (file)
@@ -350,15 +350,14 @@ void do_syscall_for_client ( Int syscallno,
 {
    vki_sigset_t saved;
    UWord err;
-#  if defined(VGO_freebsd)
-   Word real_syscallno;
-#  endif
 #  if defined(VGO_linux)
    err = ML_(do_syscall_for_client_WRK)(
             syscallno, &tst->arch.vex, 
             syscall_mask, &saved, sizeof(vki_sigset_t)
          );
 #  elif defined(VGO_freebsd)
+   Word real_syscallno;
+   VG_(sigemptyset)(&saved);
    if (tst->arch.vex.guest_SC_CLASS == VG_FREEBSD_SYSCALL0)
       real_syscallno = __NR_syscall;
    else if (tst->arch.vex.guest_SC_CLASS == VG_FREEBSD_SYSCALL198)