aboutsummaryrefslogtreecommitdiff
path: root/malloc/alloc_buffer_alloc_array.c
diff options
context:
space:
mode:
authorSzabolcs Nagy <szabolcs.nagy@arm.com>2022-03-16 12:09:15 +0000
committerSzabolcs Nagy <szabolcs.nagy@arm.com>2022-10-27 14:46:47 +0100
commita05d3855313903679c604143cdc00f803d142a71 (patch)
treed6962b7a3b72802c386430be7cd11b15317eb2d1 /malloc/alloc_buffer_alloc_array.c
parentada54f951a29c70e6bdba0c55e5e6ce4e2f65f27 (diff)
downloadglibc-a05d3855313903679c604143cdc00f803d142a71.tar
glibc-a05d3855313903679c604143cdc00f803d142a71.tar.gz
glibc-a05d3855313903679c604143cdc00f803d142a71.tar.bz2
glibc-a05d3855313903679c604143cdc00f803d142a71.zip
malloc: Use uintptr_t in alloc_buffer
The values represnt pointers and not sizes. The members of struct alloc_buffer are already uintptr_t.
Diffstat (limited to 'malloc/alloc_buffer_alloc_array.c')
-rw-r--r--malloc/alloc_buffer_alloc_array.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/malloc/alloc_buffer_alloc_array.c b/malloc/alloc_buffer_alloc_array.c
index d8c08d03ea..b5f32bb630 100644
--- a/malloc/alloc_buffer_alloc_array.c
+++ b/malloc/alloc_buffer_alloc_array.c
@@ -23,12 +23,12 @@ void *
__libc_alloc_buffer_alloc_array (struct alloc_buffer *buf, size_t element_size,
size_t align, size_t count)
{
- size_t current = buf->__alloc_buffer_current;
+ uintptr_t current = buf->__alloc_buffer_current;
/* The caller asserts that align is a power of two. */
- size_t aligned = ALIGN_UP (current, align);
+ uintptr_t aligned = ALIGN_UP (current, align);
size_t size;
bool overflow = __builtin_mul_overflow (element_size, count, &size);
- size_t new_current = aligned + size;
+ uintptr_t new_current = aligned + size;
if (!overflow /* Multiplication did not overflow. */
&& aligned >= current /* No overflow in align step. */
&& new_current >= size /* No overflow in size computation. */