Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests: x86: fix [-Wstringop-overread] warn in test_process_vm_readv()

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 <skhan@linuxfoundation.org>

+1 -1
+1 -1
tools/testing/selftests/x86/test_vsyscall.c
··· 497 497 } 498 498 499 499 if (vsyscall_map_r) { 500 - if (!memcmp(buf, (const void *)0xffffffffff600000, 4096)) { 500 + if (!memcmp(buf, remote.iov_base, sizeof(buf))) { 501 501 printf("[OK]\tIt worked and read correct data\n"); 502 502 } else { 503 503 printf("[FAIL]\tIt worked but returned incorrect data\n");