From: Paul Floyd Date: Sun, 17 Mar 2024 07:36:08 +0000 (+0100) Subject: FreeBSD regtest: make bug483786 test a bit safer X-Git-Tag: VALGRIND_3_23_0~99 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=85f0df43d1f9cbf506c1f737034bcbacdab266a9;p=thirdparty%2Fvalgrind.git FreeBSD regtest: make bug483786 test a bit safer The uninit struct timespec can have large values so set it to 0 and use VALGRIND_MAKE_MEM_UNDEFINED to trigger the error. --- diff --git a/memcheck/tests/freebsd/bug483786.c b/memcheck/tests/freebsd/bug483786.c index ab4d44b91..dc5a73471 100644 --- a/memcheck/tests/freebsd/bug483786.c +++ b/memcheck/tests/freebsd/bug483786.c @@ -1,10 +1,12 @@ - +#include "../../memcheck.h" #include /* should complain about rqtp and rmtp */ void valgrind_should_complain(void) { - struct timespec ts_uninitialized; + struct timespec ts_uninitialized = {0}; + + VALGRIND_MAKE_MEM_UNDEFINED(&ts_uninitialized, sizeof(ts_uninitialized)); clock_nanosleep(CLOCK_MONOTONIC, 0, &ts_uninitialized, &ts_uninitialized); } diff --git a/memcheck/tests/freebsd/bug483786.stderr.exp b/memcheck/tests/freebsd/bug483786.stderr.exp index b44e3324d..ac72af412 100644 --- a/memcheck/tests/freebsd/bug483786.stderr.exp +++ b/memcheck/tests/freebsd/bug483786.stderr.exp @@ -1,7 +1,7 @@ Syscall param clock_nanosleep(rqtp) points to uninitialised byte(s) ... - by 0x........: valgrind_should_complain (bug483786.c:9) - by 0x........: main (bug483786.c:32) + by 0x........: valgrind_should_complain (bug483786.c:11) + by 0x........: main (bug483786.c:34) Address 0x........ is on thread 1's stack in frame #1, created by valgrind_should_complain (bug483786.c:6)