1 // SPDX-License-Identifier: (LGPL-2.0+ OR BSD-2-Clause)
2 /* Copyright (C) 2018 Netronome Systems, Inc. */
4 #ifndef __TOOLS_LIBC_COMPAT_H
5 #define __TOOLS_LIBC_COMPAT_H
8 #include <linux/overflow.h>
10 #ifdef COMPAT_NEED_REALLOCARRAY
11 static inline void *reallocarray(void *ptr, size_t nmemb, size_t size)
15 if (unlikely(check_mul_overflow(nmemb, size, &bytes)))
17 return realloc(ptr, bytes);