Skip to contentSkip to conversation

s390x: Fix selftest malloc check

PATCH In review Janosch Frank 2 participants 4 messages Oct 23, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s390x: Fix selftest malloc check

Commit c09c54c ("lib: use an argument which doesn't require default argument promotion") broke the selftest. Let's fix it by converting the binary operations to bool.

---
 s390x/selftest.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
s390x/selftest.c +2 -2
index f4acdc4..9cd6943 100644
@@ -49,9 +49,9 @@ static void test_malloc(void)
 	*tmp2 = 123456789;
 	mb();
 
-	report("malloc: got vaddr", (uintptr_t)tmp & 0xf000000000000000ul);
+	report("malloc: got vaddr", !!((uintptr_t)tmp & 0xf000000000000000ul));
 	report("malloc: access works", *tmp == 123456789);
-	report("malloc: got 2nd vaddr", (uintptr_t)tmp2 & 0xf000000000000000ul);
+	report("malloc: got 2nd vaddr", !!((uintptr_t)tmp2 & 0xf000000000000000ul));
 	report("malloc: access works", (*tmp2 == 123456789));
 	report("malloc: addresses differ", tmp != tmp2);
 
Signature · 1 line
2.20.1
#1 lore raw
Quoted 16 lines · Janosch Frank

Commit c09c54c ("lib: use an argument which doesn't require default argument promotion") broke the selftest. Let's fix it by converting the binary operations to bool.

---
  s390x/selftest.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
s390x/selftest.c +0 -0
index f4acdc4..9cd6943 100644
@@ -49,9 +49,9 @@ static void test_malloc(void)
  	*tmp2 = 123456789;

s390x/selftest.c static void test_malloc(void) · line 57

Quoted 10 lines
s390x/selftest.c +2 -2
  	mb();
 
-	report("malloc: got vaddr", (uintptr_t)tmp & 0xf000000000000000ul);
+	report("malloc: got vaddr", !!((uintptr_t)tmp & 0xf000000000000000ul));
  	report("malloc: access works", *tmp == 123456789);
-	report("malloc: got 2nd vaddr", (uintptr_t)tmp2 & 0xf000000000000000ul);
+	report("malloc: got 2nd vaddr", !!((uintptr_t)tmp2 & 0xf000000000000000ul));
  	report("malloc: access works", (*tmp2 == 123456789));
  	report("malloc: addresses differ", tmp != tmp2);
 

See

https://lore.kernel.org/kvm/CAGG=3QUdVBg5JArMaBcRbBLrHqLLCpAcrtvgT4q1h0V7SHbbEQ@mail.gmail.com/T/

Signature · 3 lines
Thanks,

David / dhildenb
#2 lore raw
Quoted 30 lines · David Hildenbrand
Quoted 16 lines · Janosch Frank

Commit c09c54c ("lib: use an argument which doesn't require default argument promotion") broke the selftest. Let's fix it by converting the binary operations to bool.

---
  s390x/selftest.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
s390x/selftest.c +0 -0
index f4acdc4..9cd6943 100644
@@ -49,9 +49,9 @@ static void test_malloc(void)
  	*tmp2 = 123456789;

s390x/selftest.c static void test_malloc(void) · line 57

Quoted 10 lines
s390x/selftest.c +2 -2
  	mb();
 
-	report("malloc: got vaddr", (uintptr_t)tmp & 0xf000000000000000ul);
+	report("malloc: got vaddr", !!((uintptr_t)tmp & 0xf000000000000000ul));
  	report("malloc: access works", *tmp == 123456789);
-	report("malloc: got 2nd vaddr", (uintptr_t)tmp2 & 0xf000000000000000ul);
+	report("malloc: got 2nd vaddr", !!((uintptr_t)tmp2 & 0xf000000000000000ul));
  	report("malloc: access works", (*tmp2 == 123456789));
  	report("malloc: addresses differ", tmp != tmp2);
 

See

Quoted 2 lines

https://lore.kernel.org/kvm/CAGG=3QUdVBg5JArMaBcRbBLrHqLLCpAcrtvgT4q1h0V7SHbbEQ@mail.gmail.com/T/

I completely missed that patch and only looked for fixpatches on the list -_-

If possible CC me if something like this turns up, so I don't have the CI flashing red lights at me unexpectedly :)

#3 lore raw
Quoted 31 lines · Janosch Frank
Quoted 30 lines · David Hildenbrand
Quoted 16 lines · Janosch Frank

Commit c09c54c ("lib: use an argument which doesn't require default argument promotion") broke the selftest. Let's fix it by converting the binary operations to bool.

---
   s390x/selftest.c | 4 ++--
   1 file changed, 2 insertions(+), 2 deletions(-)
s390x/selftest.c +0 -0
index f4acdc4..9cd6943 100644
@@ -49,9 +49,9 @@ static void test_malloc(void)
   	*tmp2 = 123456789;

s390x/selftest.c static void test_malloc(void) · line 57

Quoted 10 lines
s390x/selftest.c +2 -2
   	mb();
 
-	report("malloc: got vaddr", (uintptr_t)tmp & 0xf000000000000000ul);
+	report("malloc: got vaddr", !!((uintptr_t)tmp & 0xf000000000000000ul));
   	report("malloc: access works", *tmp == 123456789);
-	report("malloc: got 2nd vaddr", (uintptr_t)tmp2 & 0xf000000000000000ul);
+	report("malloc: got 2nd vaddr", !!((uintptr_t)tmp2 & 0xf000000000000000ul));
   	report("malloc: access works", (*tmp2 == 123456789));
   	report("malloc: addresses differ", tmp != tmp2);
 

See

Quoted 8 lines
Quoted 2 lines

https://lore.kernel.org/kvm/CAGG=3QUdVBg5JArMaBcRbBLrHqLLCpAcrtvgT4q1h0V7SHbbEQ@mail.gmail.com/T/

I completely missed that patch and only looked for fixpatches on the list -_-

If possible CC me if something like this turns up, so I don't have the CI flashing red lights at me unexpectedly :)

Will do in case I don't forget :)

Signature · 3 lines
Thanks,

David / dhildenb