]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Explicitly make testcase variable for sys-copy_file_range undefined.
authorMark Wielaard <mark@klomp.org>
Wed, 15 May 2019 19:30:00 +0000 (21:30 +0200)
committerMark Wielaard <mark@klomp.org>
Wed, 15 May 2019 19:30:09 +0000 (21:30 +0200)
On some systems an extra warning could occur when a variable in
the memcheck/tests/linux/sys-copy_file_range testcase was undefined,
but (accidentially) pointed to known bad memory. Fix by defining the
variable as 0, but then marking it explicitly undefined using memcheck
VALGRIND_MAKE_MEM_UNDEFINED.

Followup for https://bugs.kde.org/show_bug.cgi?id=407218

memcheck/tests/linux/sys-copy_file_range.c

index 83981c6b5d732dd63a5df1689aeaa23e7615541b..589399c6bb040375775937b0061fb8e4493d9bee 100644 (file)
@@ -3,8 +3,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/stat.h>
-#include <sys/syscall.h>
 #include <unistd.h>
+#include "../../memcheck.h"
 
 int main(int argc, char **argv)
 {
@@ -51,7 +51,7 @@ int main(int argc, char **argv)
     /* Check valgrind will produce expected warnings for the
        various wrong arguments. */
     do {
-        void *t;
+        void *t = 0; VALGRIND_MAKE_MEM_UNDEFINED (&t, sizeof (void *));
         void *z = (void *) -1;
 
         ret = copy_file_range(fd_in, t, fd_out, NULL, len, 0);