mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-26 03:55:32 +07:00
080220b687
libc_compat.h is used by libbpf so make sure it's licensed under LGPL or BSD license. The license change should be OK, I'm the only author of the file. Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com> Acked-by: Yonghong Song <yhs@fb.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
21 lines
453 B
C
21 lines
453 B
C
// SPDX-License-Identifier: (LGPL-2.0+ OR BSD-2-Clause)
|
|
/* Copyright (C) 2018 Netronome Systems, Inc. */
|
|
|
|
#ifndef __TOOLS_LIBC_COMPAT_H
|
|
#define __TOOLS_LIBC_COMPAT_H
|
|
|
|
#include <stdlib.h>
|
|
#include <linux/overflow.h>
|
|
|
|
#ifdef COMPAT_NEED_REALLOCARRAY
|
|
static inline void *reallocarray(void *ptr, size_t nmemb, size_t size)
|
|
{
|
|
size_t bytes;
|
|
|
|
if (unlikely(check_mul_overflow(nmemb, size, &bytes)))
|
|
return NULL;
|
|
return realloc(ptr, bytes);
|
|
}
|
|
#endif
|
|
#endif
|