We get pointer to mask before we check if fbarray is NULL. Fix
by moving getting mask pointer to until after NULL check.
Coverity issue: 272579
Fixes:
c44d09811b40 ("eal: add shared indexed file-backed array")
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
static int
set_used(struct rte_fbarray *arr, unsigned int idx, bool used)
{
- struct used_mask *msk = get_used_mask(arr->data, arr->elt_sz, arr->len);
+ struct used_mask *msk;
uint64_t msk_bit = 1ULL << MASK_LEN_TO_MOD(idx);
unsigned int msk_idx = MASK_LEN_TO_IDX(idx);
bool already_used;
rte_errno = EINVAL;
return -1;
}
+ msk = get_used_mask(arr->data, arr->elt_sz, arr->len);
ret = 0;
/* prevent array from changing under us */