Skip to content

Commit

Permalink
selftests: x86: fix [-Wstringop-overread] warn in test_process_vm_rea…
Browse files Browse the repository at this point in the history
…dv()

commit dd40f44 upstream.

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>
Cc: Naresh Kamboju <naresh.kamboju@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
shuahkh authored and gregkh committed Jan 11, 2022
1 parent ef3047f commit 3cf50a3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/testing/selftests/x86/test_vsyscall.c
Expand Up @@ -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");
Expand Down

0 comments on commit 3cf50a3

Please sign in to comment.