malloc: add alloc_size attribute to functions
authorStephen Hemminger <stephen@networkplumber.org>
Thu, 15 Oct 2020 00:55:24 +0000 (17:55 -0700)
committerThomas Monjalon <thomas@monjalon.net>
Mon, 19 Oct 2020 14:25:43 +0000 (16:25 +0200)
commit17b347dab769a3f61e00195dac2c9dfdf5d11474
tree718d2bcf404f1ee1ebcbf86304923cabdc3d22fa
parentf030bff72f8140857388e92204002cb64153459c
malloc: add alloc_size attribute to functions

By using the alloc_size() attribute the compiler can optimize
better and detect errors at compile time.

For example, Gcc will fail one of the invalid allocation examples
in app/test/test_malloc.c because the allocation is outside the
limits of memory.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
app/test/test_malloc.c
lib/librte_eal/include/rte_common.h
lib/librte_eal/include/rte_malloc.h