Hello Andrey Konovalov,
The patch 9ce1263033cd: "selftests, arm64: add a selftest for passing tagged pointers to kernel" from Jul 23, 2019, leads to the following static checker warning:
./tools/testing/selftests/arm64/tags_test.c:25 main() error: uninitialized symbol 'tagged_ptr'.
tools/testing/selftests/arm64/tags_test.c 14 int main(void) 15 { 16 static int tbi_enabled = 0; 17 struct utsname *ptr, *tagged_ptr; ^^^^^^^^^^
18 int err; 19 20 if (prctl(PR_SET_TAGGED_ADDR_CTRL, PR_TAGGED_ADDR_ENABLE, 0, 0, 0) == 0) 21 tbi_enabled = 1; 22 ptr = (struct utsname *)malloc(sizeof(*ptr)); 23 if (tbi_enabled) 24 tagged_ptr = (struct utsname *)SET_TAG(ptr, 0x42); ^^^^^^^^^^^^^^^ No else path.
25 err = uname(tagged_ptr); 26 free(ptr); 27 28 return err; 29 }
regards, dan carpenter
On Thu, Aug 15, 2019 at 10:18 AM Dan Carpenter dan.carpenter@oracle.com wrote:
Hello Andrey Konovalov,
The patch 9ce1263033cd: "selftests, arm64: add a selftest for passing tagged pointers to kernel" from Jul 23, 2019, leads to the following static checker warning:
./tools/testing/selftests/arm64/tags_test.c:25 main() error: uninitialized symbol 'tagged_ptr'.
tools/testing/selftests/arm64/tags_test.c 14 int main(void) 15 { 16 static int tbi_enabled = 0; 17 struct utsname *ptr, *tagged_ptr; ^^^^^^^^^^
18 int err; 19 20 if (prctl(PR_SET_TAGGED_ADDR_CTRL, PR_TAGGED_ADDR_ENABLE, 0, 0, 0) == 0) 21 tbi_enabled = 1; 22 ptr = (struct utsname *)malloc(sizeof(*ptr)); 23 if (tbi_enabled) 24 tagged_ptr = (struct utsname *)SET_TAG(ptr, 0x42); ^^^^^^^^^^^^^^^
No else path.
25 err = uname(tagged_ptr); 26 free(ptr); 27 28 return err; 29 }
regards, dan carpenter
Hi Dan,
Just sent a patch with a fix.
Thanks for the report!
linux-kselftest-mirror@lists.linaro.org