summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2025-08-10 23:43:37 +0200
committerWilco Dijkstra <wilco.dijkstra@arm.com>2025-08-11 14:33:39 +0000
commitd7274d718e6f3655eabe311d4eb70fabb5ffa7ef (patch)
tree9a3fba1c82ca5954107cf3dc06e326c1da0caee0
parenta96a82c4a5efd3139e75cd11fd2a5554164dd5a0 (diff)
malloc: Fix checking for small negative values of tcache_key
tcache_key is unsigned so we should turn it explicitly to signed before taking its absolute value. (cherry picked from commit 8543577b04ded6d979ffcc5a818930e4d74d0645)
-rw-r--r--malloc/malloc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/malloc/malloc.c b/malloc/malloc.c
index e4e2f03600..5f3e701fd1 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -3165,7 +3165,7 @@ tcache_key_initialize (void)
int minimum_bits = __WORDSIZE / 4;
int maximum_bits = __WORDSIZE - minimum_bits;
- while (labs (tcache_key) <= 0x1000000
+ while (labs ((intptr_t) tcache_key) <= 0x1000000
|| stdc_count_ones (tcache_key) < minimum_bits
|| stdc_count_ones (tcache_key) > maximum_bits)
{