summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Konovalov <andreyknvl@google.com>2019-08-19 15:14:42 +0200
committerWill Deacon <will@kernel.org>2019-08-19 16:25:32 +0100
commit74585fcb7b3ccb35135e2418dd66251022a916e5 (patch)
treec0b20c28b7c2b714f4aae3b63e7aac6b48ccc04b
parent9c1cac424c93d2b3122014e07a54b003ddedc168 (diff)
downloadlinux-stable-74585fcb7b3ccb35135e2418dd66251022a916e5.tar.gz
linux-stable-74585fcb7b3ccb35135e2418dd66251022a916e5.tar.bz2
linux-stable-74585fcb7b3ccb35135e2418dd66251022a916e5.zip
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.html Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Andrey Konovalov <andreyknvl@google.com> Signed-off-by: Will Deacon <will@kernel.org>
-rw-r--r--tools/testing/selftests/arm64/tags_test.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/tools/testing/selftests/arm64/tags_test.c b/tools/testing/selftests/arm64/tags_test.c
index 22a1b266e373..5701163460ef 100644
--- a/tools/testing/selftests/arm64/tags_test.c
+++ b/tools/testing/selftests/arm64/tags_test.c
@@ -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;