mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-19 05:43:18 +03:00
malloc: Use uintptr_t in alloc_buffer
The values represnt pointers and not sizes. The members of struct alloc_buffer are already uintptr_t. Reviewed-by: Florian Weimer <fweimer@redhat.com>
This commit is contained in:
@ -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. */
|
||||
|
Reference in New Issue
Block a user