From 5a10cd2060c19959e2c55ee33421baa358c09c0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Mon, 7 Sep 2020 21:19:02 +0200 Subject: [PATCH] remove internal reallocarray() ... as it's covered by libbpf_reallocarray() since commit dc70da9c70. --- include/tools/libc_compat.h | 20 -------------------- scripts/check-reallocarray.sh | 19 ------------------- scripts/sync-kernel.sh | 1 - src/Makefile | 5 ----- 4 files changed, 45 deletions(-) delete mode 100644 include/tools/libc_compat.h delete mode 100755 scripts/check-reallocarray.sh diff --git a/include/tools/libc_compat.h b/include/tools/libc_compat.h deleted file mode 100644 index e907ba6..0000000 --- a/include/tools/libc_compat.h +++ /dev/null @@ -1,20 +0,0 @@ -// 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 -#include - -#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 diff --git a/scripts/check-reallocarray.sh b/scripts/check-reallocarray.sh deleted file mode 100755 index d3044ad..0000000 --- a/scripts/check-reallocarray.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -# Usage: check-reallocarray.sh cc_path [cc_args...] - -tfile=$(mktemp /tmp/test_reallocarray_XXXXXXXX.c) -ofile=${tfile%.c}.o - -cat > $tfile < - -int main(void) -{ - return !!reallocarray(NULL, 1, 1); -} -EOL - -"$@" $tfile -o $ofile >/dev/null 2>&1 -if [ $? -ne 0 ]; then echo "FAIL"; fi -/bin/rm -f $tfile $ofile diff --git a/scripts/sync-kernel.sh b/scripts/sync-kernel.sh index c85a8a6..34dafbb 100755 --- a/scripts/sync-kernel.sh +++ b/scripts/sync-kernel.sh @@ -45,7 +45,6 @@ PATH_MAP=( \ [tools/include/uapi/linux/if_link.h]=include/uapi/linux/if_link.h \ [tools/include/uapi/linux/if_xdp.h]=include/uapi/linux/if_xdp.h \ [tools/include/uapi/linux/netlink.h]=include/uapi/linux/netlink.h \ - [tools/include/tools/libc_compat.h]=include/tools/libc_compat.h \ ) LIBBPF_PATHS="${!PATH_MAP[@]} :^tools/lib/bpf/Makefile :^tools/lib/bpf/Build :^tools/lib/bpf/.gitignore" diff --git a/src/Makefile b/src/Makefile index 74234f6..31c5fd9 100644 --- a/src/Makefile +++ b/src/Makefile @@ -10,11 +10,6 @@ TOPDIR = .. INCLUDES := -I. -I$(TOPDIR)/include -I$(TOPDIR)/include/uapi ALL_CFLAGS := $(INCLUDES) -FEATURE_REALLOCARRAY := $(shell $(TOPDIR)/scripts/check-reallocarray.sh $(CC)) -ifneq ($(FEATURE_REALLOCARRAY),) - ALL_CFLAGS += -DCOMPAT_NEED_REALLOCARRAY -endif - SHARED_CFLAGS += -fPIC -fvisibility=hidden -DSHARED CFLAGS ?= -g -O2 -Werror -Wall