pipeline: fix build with glibc < 2.26
authorDavid Marchand <david.marchand@redhat.com>
Fri, 2 Oct 2020 08:28:31 +0000 (10:28 +0200)
committerDavid Marchand <david.marchand@redhat.com>
Fri, 2 Oct 2020 11:49:16 +0000 (13:49 +0200)
commit2a8be2ff7530c5031c5b29bf4f0353e3d2d4aee0
tree4fdfdff5e866d4e579df9314020ab981fac9ef3d
parent6b901437056eed3ed7c9932c333ba24ac5be116f
pipeline: fix build with glibc < 2.26

reallocarray has been introduced in glibc 2.26 but we still support
glibc >= 2.7.
Simply replace with realloc, as the considered sizes are unlikely to
overflow.

"""
The reallocarray() function changes the size of the memory block
pointed to by ptr to be large enough for an array of nmemb elements,
each of which is size bytes.  It is equivalent to the call

       realloc(ptr, nmemb * size);

However, unlike that realloc() call, reallocarray() fails safely in
the case where the multiplication would overflow.  If such an over‐
flow occurs, reallocarray() returns NULL, sets errno to ENOMEM, and
leaves the original block of memory unchanged.
"""

Fixes: 3ca60ceed79a ("pipeline: add SWX pipeline specification file")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
lib/librte_pipeline/rte_swx_pipeline_spec.c