Skip to content

Commit

Permalink
selftests, arm64: fix uninitialized symbol in tags_test.c
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Andrey Konovalov <[email protected]>
Signed-off-by: Will Deacon <[email protected]>
  • Loading branch information
xairy authored and willdeacon committed Aug 19, 2019
1 parent 9c1cac4 commit 74585fc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tools/testing/selftests/arm64/tags_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 74585fc

Please sign in to comment.