patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] malloc: fix size annotation for NUMA-aware realloc
@ 2021-06-10 12:09 David Marchand
  2021-06-10 12:19 ` Maxime Coquelin
  2021-06-11  7:26 ` [dpdk-stable] [dpdk-dev] " David Marchand
  0 siblings, 2 replies; 6+ messages in thread
From: David Marchand @ 2021-06-10 12:09 UTC (permalink / raw)
  To: dev; +Cc: maxime.coquelin, stable, Anatoly Burakov, Stephen Hemminger

__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 <david.marchand@redhat.com>
---
 lib/eal/include/rte_malloc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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
-- 
2.23.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-06-11 19:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-10 12:09 [dpdk-stable] [PATCH] malloc: fix size annotation for NUMA-aware realloc David Marchand
2021-06-10 12:19 ` Maxime Coquelin
2021-06-11  9:19   ` David Marchand
2021-06-11  7:26 ` [dpdk-stable] [dpdk-dev] " David Marchand
2021-06-11  7:39   ` David Marchand
2021-06-11 19:02     ` [dpdk-stable] [dts] " Owen Hilyard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).