From: Paul Floyd Date: Thu, 10 Nov 2022 21:31:07 +0000 (+0100) Subject: Bug 170510 - Don't warn about ioctl of size 0 without direction hint X-Git-Tag: VALGRIND_3_21_0~277 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f2550057e1e9918c9dfc8fde44db37beac2cc563;p=thirdparty%2Fvalgrind.git Bug 170510 - Don't warn about ioctl of size 0 without direction hint Apply this to generic and update the message on all platforms. --- diff --git a/NEWS b/NEWS index 208d8afab7..fe94546fbd 100644 --- a/NEWS +++ b/NEWS @@ -20,7 +20,8 @@ bugzilla (https://bugs.kde.org/enter_bug.cgi?product=valgrind) rather than mailing the developers (or mailing lists) directly -- bugs that are not entered into bugzilla tend to get forgotten about or ignored. -444110 priv/guest_ppc_toIR.c:36198:31: warning: duplicated 'if' condition. +170510 Don't warn about ioctl of size 0 without direction hint +444110 priv/guest_ppc_toIR.c:36198:31: warning: duplicated 'if' condition. To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index 0fad6aa844..0dc76854ef 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -1013,7 +1013,7 @@ PRE(sys_ioctl) * drivers with a large number of strange ioctl * commands becomes very tiresome. */ - } else if ((dir == _VKI_IOC_NONE) && size > 0) { + } else if (dir == _VKI_IOC_NONE && size > 0) { static UWord unknown_ioctl[10]; static Int moans = sizeof(unknown_ioctl) / sizeof(unknown_ioctl[0]); if (moans > 0 && !VG_(clo_xml)) { @@ -1026,11 +1026,10 @@ PRE(sys_ioctl) unknown_ioctl[i] = ARG2; moans--; VG_(umsg)("Warning: noted but unhandled ioctl 0x%lx" - " with no size/direction hints.\n", ARG2); + " with no direction hints.\n", ARG2); VG_(umsg)(" This could cause spurious value errors to appear.\n"); VG_(umsg)(" See README_MISSING_SYSCALL_OR_IOCTL for " "guidance on writing a proper wrapper.\n" ); - //VG_(get_and_pp_StackTrace)(tid, VG_(clo_backtrace_size)); return; } } diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c index 7d11ff4064..f0796f8ebc 100644 --- a/coregrind/m_syswrap/syswrap-generic.c +++ b/coregrind/m_syswrap/syswrap-generic.c @@ -3795,7 +3795,7 @@ void ML_(PRE_unknown_ioctl)(ThreadId tid, UWord request, UWord arg) * drivers with a large number of strange ioctl * commands becomes very tiresome. */ - } else if (/* size == 0 || */ dir == _VKI_IOC_NONE) { + } else if (dir == _VKI_IOC_NONE && size > 0) { static UWord unknown_ioctl[10]; static Int moans = sizeof(unknown_ioctl) / sizeof(unknown_ioctl[0]); @@ -3809,7 +3809,7 @@ void ML_(PRE_unknown_ioctl)(ThreadId tid, UWord request, UWord arg) unknown_ioctl[i] = request; moans--; VG_(umsg)("Warning: noted but unhandled ioctl 0x%lx" - " with no size/direction hints.\n", request); + " with no direction hints.\n", request); VG_(umsg)(" This could cause spurious value errors to appear.\n"); VG_(umsg)(" See README_MISSING_SYSCALL_OR_IOCTL for " "guidance on writing a proper wrapper.\n" ); diff --git a/none/tests/ioctl_moans.stderr.exp b/none/tests/ioctl_moans.stderr.exp index 2a1ac04ce1..4d7912e4a1 100644 --- a/none/tests/ioctl_moans.stderr.exp +++ b/none/tests/ioctl_moans.stderr.exp @@ -1,30 +1,30 @@ -Warning: noted but unhandled ioctl 0x.2345670 with no size/direction hints. +Warning: noted but unhandled ioctl 0x.2345670 with no direction hints. This could cause spurious value errors to appear. See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper. -Warning: noted but unhandled ioctl 0x.2345671 with no size/direction hints. +Warning: noted but unhandled ioctl 0x.2345671 with no direction hints. This could cause spurious value errors to appear. See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper. -Warning: noted but unhandled ioctl 0x.2345672 with no size/direction hints. +Warning: noted but unhandled ioctl 0x.2345672 with no direction hints. This could cause spurious value errors to appear. See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper. -Warning: noted but unhandled ioctl 0x.2345673 with no size/direction hints. +Warning: noted but unhandled ioctl 0x.2345673 with no direction hints. This could cause spurious value errors to appear. See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper. -Warning: noted but unhandled ioctl 0x.2345674 with no size/direction hints. +Warning: noted but unhandled ioctl 0x.2345674 with no direction hints. This could cause spurious value errors to appear. See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper. -Warning: noted but unhandled ioctl 0x.2345675 with no size/direction hints. +Warning: noted but unhandled ioctl 0x.2345675 with no direction hints. This could cause spurious value errors to appear. See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper. -Warning: noted but unhandled ioctl 0x.2345676 with no size/direction hints. +Warning: noted but unhandled ioctl 0x.2345676 with no direction hints. This could cause spurious value errors to appear. See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper. -Warning: noted but unhandled ioctl 0x.2345677 with no size/direction hints. +Warning: noted but unhandled ioctl 0x.2345677 with no direction hints. This could cause spurious value errors to appear. See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper. -Warning: noted but unhandled ioctl 0x.2345678 with no size/direction hints. +Warning: noted but unhandled ioctl 0x.2345678 with no direction hints. This could cause spurious value errors to appear. See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper. -Warning: noted but unhandled ioctl 0x.2345679 with no size/direction hints. +Warning: noted but unhandled ioctl 0x.2345679 with no direction hints. This could cause spurious value errors to appear. See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper.