> The return value of rte_mempool_default_cache should be
> checked as it can be NULL.
>
> Fixes: 9ab9514c150e ("net/iavf: enable AVX512 for Tx")
>
> Reported-by: Konstantin Ananyev <konstantin.anan...@intel.com>
> Signed-off-by: Wenzhuo Lu <wenzhuo...@intel.com>
> ---
> drivers/net/iavf/iavf_rxtx_vec_avx512.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/iavf/iavf_rxtx_vec_avx512.c
> b/drivers/net/iavf/iavf_rxtx_vec_avx512.c
> index 8680734..584d12e 100644
> --- a/drivers/net/iavf/iavf_rxtx_vec_avx512.c
> +++ b/drivers/net/iavf/iavf_rxtx_vec_avx512.c
> @@ -1424,7 +1424,12 @@
> struct rte_mempool *mp = txep[0].mbuf->pool;
> struct rte_mempool_cache *cache = rte_mempool_default_cache(mp,
> rte_lcore_id());
> - void **cache_objs = &cache->objs[cache->len];
> + void **cache_objs;
> +
> + if (!cache || cache->len == 0)
> + goto normal;
> +
> + cache_objs = &cache->objs[cache->len];
>
> if (n > RTE_MEMPOOL_CACHE_MAX_SIZE) {
> rte_mempool_ops_enqueue_bulk(mp, (void *)txep, n);
> @@ -1462,6 +1467,7 @@
> goto done;
> }
>
> +normal:
> m = rte_pktmbuf_prefree_seg(txep[0].mbuf);
> if (likely(m)) {
> free[0] = m;
> --
Acked-by: Konstantin Ananyev <konstantin.anan...@intel.com>
> 1.9.3