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 9570CA052A; Tue, 10 Nov 2020 07:46:45 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 569C55928; Tue, 10 Nov 2020 07:46:34 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 4A2735913 for ; Tue, 10 Nov 2020 07:46:33 +0100 (CET) IronPort-SDR: fa0vKyVPNehmpfc5OQeYE9CGYvUOtbUfmjR5ShAancFX66xzA6JhaCa4DaCEBe1usqVaFFUiCI +bmXxOhBoHrg== X-IronPort-AV: E=McAfee;i="6000,8403,9800"; a="157708186" X-IronPort-AV: E=Sophos;i="5.77,465,1596524400"; d="scan'208";a="157708186" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2020 22:46:30 -0800 IronPort-SDR: +VfrRaCCAlLaT+yISzTODcvjF6rF1avGaZs8f1oCErciXhEenQXuFtIbtRChylJyupDZ7cfqKS RoymCI0pVkcA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,465,1596524400"; d="scan'208";a="473309917" Received: from dpdk-wenzhuo-haswell.sh.intel.com ([10.67.111.137]) by orsmga004.jf.intel.com with ESMTP; 09 Nov 2020 22:46:28 -0800 From: Wenzhuo Lu To: dev@dpdk.org Cc: Wenzhuo Lu Date: Tue, 10 Nov 2020 14:46:01 +0800 Message-Id: <1604990761-61335-1-git-send-email-wenzhuo.lu@intel.com> X-Mailer: git-send-email 1.9.3 Subject: [dpdk-dev] [PATCH] net/iavf: 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: 9ab9514c150e ("net/iavf: enable AVX512 for Tx") Reported-by: Konstantin Ananyev Signed-off-by: Wenzhuo Lu --- 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; -- 1.9.3