From: David Marchand Date: Thu, 10 Jun 2021 12:09:22 +0000 (+0200) Subject: malloc: fix size annotation for NUMA-aware realloc X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=2ca92f54410400af76a1f0bc3bfecc8077e282aa;p=dpdk.git malloc: fix size annotation for NUMA-aware realloc __rte_alloc_size is mapped to compiler alloc_size attribute. Quoting gcc documentation: """ alloc_size The alloc_size attribute is used to tell the compiler that the function return value points to memory, where the size is given by one or two of the functions parameters. GCC uses this information to improve the correctness of __builtin_object_size. The function parameter(s) denoting the allocated size are specified by one or two integer arguments supplied to the attribute. The allocated size is either the value of the single function argument specified or the product of the two function arguments specified. Argument numbering starts at one. """ In rte_realloc_socket case, only 'size' matters. Note: this has been spotted by Maxime trying to use rte_realloc_socket and compiling with gcc 11. Fixes: 17b347dab769 ("malloc: add alloc_size attribute to functions") Cc: stable@dpdk.org Signed-off-by: David Marchand Tested-by: Maxime Coquelin --- diff --git a/lib/eal/include/rte_malloc.h b/lib/eal/include/rte_malloc.h index 3af64f8761..895bb6e849 100644 --- a/lib/eal/include/rte_malloc.h +++ b/lib/eal/include/rte_malloc.h @@ -160,7 +160,7 @@ rte_realloc(void *ptr, size_t size, unsigned int align) __rte_experimental void * rte_realloc_socket(void *ptr, size_t size, unsigned int align, int socket) - __rte_alloc_size(2, 3); + __rte_alloc_size(2); /** * This function allocates memory from the huge-page area of memory. The memory