summary refs log tree commit diff
path: root/malloc/alloc_buffer_alloc_array.c
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2018-12-21 09:49:37 -0200
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2018-12-28 15:39:45 -0200
commit0253580a75decdaf22b6abce60d8265b2adb7dea (patch)
tree9c2ff33657d7044ad615141eb2279abb166c757d /malloc/alloc_buffer_alloc_array.c
parent09104e5ba47de6691a371d214da48dd8493c39bd (diff)
downloadglibc-0253580a75decdaf22b6abce60d8265b2adb7dea.tar.gz
glibc-0253580a75decdaf22b6abce60d8265b2adb7dea.tar.xz
glibc-0253580a75decdaf22b6abce60d8265b2adb7dea.zip
Replace check_mul_overflow_size_t with __builtin_mul_overflow
Checked on x86_64-linux-gnu and i686-linux-gnu.

	* malloc/alloc_buffer_alloc_array.c (__libc_alloc_buffer_alloc_array):
	Use __builtin_mul_overflow in place of check_mul_overflow_size_t.
	* malloc/dynarray_emplace_enlarge.c (__libc_dynarray_emplace_enlarge):
	Likewise.
	* malloc/dynarray_resize.c (__libc_dynarray_resize): Likewise.
	* malloc/reallocarray.c (__libc_reallocarray): Likewise.
	* malloc/malloc-internal.h (check_mul_overflow_size_t): Remove
	function.
	* support/blob_repeat.c (check_mul_overflow_size_t,
	(minimum_stride_size, support_blob_repeat_allocate): Likewise.
Diffstat (limited to 'malloc/alloc_buffer_alloc_array.c')
-rw-r--r--malloc/alloc_buffer_alloc_array.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/malloc/alloc_buffer_alloc_array.c b/malloc/alloc_buffer_alloc_array.c
index 1dd098a8fc..7505422b43 100644
--- a/malloc/alloc_buffer_alloc_array.c
+++ b/malloc/alloc_buffer_alloc_array.c
@@ -17,7 +17,6 @@
    <http://www.gnu.org/licenses/>.  */
 
 #include <alloc_buffer.h>
-#include <malloc-internal.h>
 #include <libc-pointer-arith.h>
 
 void *
@@ -28,7 +27,7 @@ __libc_alloc_buffer_alloc_array (struct alloc_buffer *buf, size_t element_size,
   /* The caller asserts that align is a power of two.  */
   size_t aligned = ALIGN_UP (current, align);
   size_t size;
-  bool overflow = check_mul_overflow_size_t (element_size, count, &size);
+  bool overflow = __builtin_mul_overflow (element_size, count, &size);
   size_t new_current = aligned + size;
   if (!overflow                /* Multiplication did not overflow.  */
       && aligned >= current    /* No overflow in align step.  */