On 13-Apr-18 7:43 PM, Adrien Mazarguil wrote:
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.
Fixes: c44d09811b40 ("eal: add shared indexed file-backed array")
Cc: Anatoly Burakov <anatoly.bura...@intel.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarg...@6wind.com>
- Added INT_MAX upper bound check in fully_validate() as suggested by
- Added a sysconf() result check to appease Coverity since calc_data_size()
now takes an unsigned page size (Coverity issues 272598 and 272599).
Removed unnecessary "(unsigned int)" cast leftovers.
Acked-by: Anatoly Burakov <anatoly.bura...@intel.com>