]> Git Repo - linux.git/commitdiff
selftests: x86: fix [-Wstringop-overread] warn in test_process_vm_readv()
authorShuah Khan <[email protected]>
Thu, 21 Oct 2021 21:33:33 +0000 (15:33 -0600)
committerShuah Khan <[email protected]>
Mon, 25 Oct 2021 15:27:20 +0000 (09:27 -0600)
Fix the following [-Wstringop-overread] by passing in the variable
instead of the value.

test_vsyscall.c: In function ‘test_process_vm_readv’:
test_vsyscall.c:500:22: warning: ‘__builtin_memcmp_eq’ specified bound 4096 exceeds source size 0 [-Wstringop-overread]
  500 |                 if (!memcmp(buf, (const void *)0xffffffffff600000, 4096)) {
      |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Shuah Khan <[email protected]>
tools/testing/selftests/x86/test_vsyscall.c

index 65c141ebfbbde8ded6f4d9af1ebe879a616b6e95..5b45e6986aeab16d0b72a091969f8265f2479fbe 100644 (file)
@@ -497,7 +497,7 @@ static int test_process_vm_readv(void)
        }
 
        if (vsyscall_map_r) {
-               if (!memcmp(buf, (const void *)0xffffffffff600000, 4096)) {
+               if (!memcmp(buf, remote.iov_base, sizeof(buf))) {
                        printf("[OK]\tIt worked and read correct data\n");
                } else {
                        printf("[FAIL]\tIt worked but returned incorrect data\n");
This page took 0.05383 seconds and 4 git commands to generate.