Commit 74585fcb authored by Andrey Konovalov's avatar Andrey Konovalov Committed by Will Deacon

selftests, arm64: fix uninitialized symbol in tags_test.c

Fix tagged_ptr not being initialized when TBI is not enabled.

Link: https://www.spinics.net/lists/linux-kselftest/msg09446.htmlReported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarAndrey Konovalov <andreyknvl@google.com>
Signed-off-by: default avatarWill Deacon <will@kernel.org>
parent 9c1cac42
......@@ -14,15 +14,17 @@
int main(void)
{
static int tbi_enabled = 0;
struct utsname *ptr, *tagged_ptr;
unsigned long tag = 0;
struct utsname *ptr;
int err;
if (prctl(PR_SET_TAGGED_ADDR_CTRL, PR_TAGGED_ADDR_ENABLE, 0, 0, 0) == 0)
tbi_enabled = 1;
ptr = (struct utsname *)malloc(sizeof(*ptr));
if (tbi_enabled)
tagged_ptr = (struct utsname *)SET_TAG(ptr, 0x42);
err = uname(tagged_ptr);
tag = 0x42;
ptr = (struct utsname *)SET_TAG(ptr, tag);
err = uname(ptr);
free(ptr);
return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment