From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1B661A052A; Tue, 10 Nov 2020 07:46:30 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DBEDAF90; Tue, 10 Nov 2020 07:46:27 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id B39DADED for ; Tue, 10 Nov 2020 07:46:24 +0100 (CET) IronPort-SDR: 0mgnUgDb6Gup/BfM3QGUfQgjRF6KAahoIlQn3j7+VTtg6SE+JGeAvCznWY3l5AKa3+0tPz3NwI PfZ3+VzYgeDg== X-IronPort-AV: E=McAfee;i="6000,8403,9800"; a="166417540" X-IronPort-AV: E=Sophos;i="5.77,465,1596524400"; d="scan'208";a="166417540" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2020 22:46:21 -0800 IronPort-SDR: JGXEhJSJRFij7GTxjqAuJUPV51sGQPprjPY3wwErAehCNcldidHwphfRLQZ77DU6SJTGvCl/jB e1YoixfuxEug== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,465,1596524400"; d="scan'208";a="541207494" Received: from dpdk-wenzhuo-haswell.sh.intel.com ([10.67.111.137]) by orsmga005.jf.intel.com with ESMTP; 09 Nov 2020 22:46:20 -0800 From: Wenzhuo Lu To: dev@dpdk.org Cc: Wenzhuo Lu Date: Tue, 10 Nov 2020 14:45:52 +0800 Message-Id: <1604990752-61283-1-git-send-email-wenzhuo.lu@intel.com> X-Mailer: git-send-email 1.9.3 Subject: [dpdk-dev] [PATCH] net/ice: fix missed pointer check X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The return value of rte_mempool_default_cache should be checked as it can be NULL. Fixes: a4e480de268e ("net/ice: optimize Tx by using AVX512") Reported-by: Konstantin Ananyev Signed-off-by: Wenzhuo Lu --- drivers/net/ice/ice_rxtx_vec_avx512.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/ice/ice_rxtx_vec_avx512.c b/drivers/net/ice/ice_rxtx_vec_avx512.c index e5e7cc1..af6b324 100644 --- a/drivers/net/ice/ice_rxtx_vec_avx512.c +++ b/drivers/net/ice/ice_rxtx_vec_avx512.c @@ -781,9 +781,14 @@ if (txq->offloads & DEV_TX_OFFLOAD_MBUF_FAST_FREE && (n & 31) == 0) { struct rte_mempool *mp = txep[0].mbuf->pool; + void **cache_objs; struct rte_mempool_cache *cache = rte_mempool_default_cache(mp, rte_lcore_id()); - void **cache_objs = &cache->objs[cache->len]; + + 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); @@ -821,6 +826,7 @@ goto done; } +normal: m = rte_pktmbuf_prefree_seg(txep[0].mbuf); if (likely(m)) { free[0] = m; -- 1.9.3