eal: fix signed integers in fbarray
authorAdrien Mazarguil <adrien.mazarguil@6wind.com>
Fri, 13 Apr 2018 18:43:01 +0000 (20:43 +0200)
committerThomas Monjalon <thomas@monjalon.net>
Tue, 17 Apr 2018 12:38:16 +0000 (14:38 +0200)
commit6b298c62858d9bfd6bb58deaf961ae3bd91746b2
treef77b0bc4b5de3f5cf8333ada10e5540c833c8333
parentf2e5e858246629ff8a2715d359700b1c45cdd253
eal: fix signed integers in fbarray

While debugging startup issues encountered with Clang (see "eal: fix
undefined behavior in fbarray"), I noticed that fbarray stores indices,
sizes and masks on signed integers involved in bitwise operations.

Such operations almost invariably cause undefined behavior with values that
cannot be represented by the result type, as is often the case with
bit-masks and left-shifts.

This patch replaces them with unsigned integers as a safety measure and
promotes a few internal variables to larger types for consistency.

Coverity issue: 272598, 272599
Fixes: c44d09811b40 ("eal: add shared indexed file-backed array")

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
lib/librte_eal/common/eal_common_fbarray.c
lib/librte_eal/common/include/rte_fbarray.h