]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
FreeBSD regtest: make bug483786 test a bit safer
authorPaul Floyd <pjfloyd@wanadoo.fr>
Sun, 17 Mar 2024 07:36:08 +0000 (08:36 +0100)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Sun, 17 Mar 2024 07:40:13 +0000 (08:40 +0100)
The uninit struct timespec can have large values so set it to 0
and use VALGRIND_MAKE_MEM_UNDEFINED to trigger the error.

memcheck/tests/freebsd/bug483786.c
memcheck/tests/freebsd/bug483786.stderr.exp

index ab4d44b91b8ae0822ea051eac6bff0a7f9aead0d..dc5a734718cc6110aeec5bfb2c75b35cf23cc0ef 100644 (file)
@@ -1,10 +1,12 @@
-
+#include "../../memcheck.h"
 #include <time.h>
 
 /* 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);
 }
index b44e3324d9edb749dbe583f04e158f23ba66479e..ac72af412ac0d03c133d86405a5067cbaa804504 100644 (file)
@@ -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)