net/ice: fix missed pointer check
PATCH 1/1 net/ice: fix missed pointer check
The return value of rte_mempool_default_cache should be checked as it can be NULL.
--- drivers/net/ice/ice_rxtx_vec_avx512.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/ice/ice_rxtx_vec_avx512.c +7 -1
@@ -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;
Signature · 1 line
1.9.3
Quoted 41 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Wenzhuo Lu
Sent: Tuesday, November 10, 2020 6:46 AM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>
Subject: [dpdk-dev] [PATCH] net/ice: fix missed pointer checkThe return value of
rte_mempool_default_cacheshould be checked as it can be NULL.Fixes a4e480de268e ("net/ice: optimize Tx by using AVX512")Reported-by Konstantin Ananyev <[email protected]>Signed-off-by Wenzhuo Lu <[email protected]>--- drivers/net/ice/ice_rxtx_vec_avx512.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)drivers/net/ice/ice_rxtx_vec_avx512.c +6
-1@@ -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);
drivers/net/ice/ice_rxtx_vec_avx512.c
Quoted 8 lines
drivers/net/ice/ice_rxtx_vec_avx512.c +1
-1@@ -821,6 +826,7 @@ goto done; } +normal: m =rte_pktmbuf_prefree_seg (txep[0 ].mbuf);if (likely (m)) { free[0 ] = m; --
Quoted 1 line
1.9.3
Zhang, Qi Z
AppliedQuoted 57 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Ananyev, Konstantin
Sent: Tuesday, November 10, 2020 6:05 PM
To: Lu, Wenzhuo <[email protected]>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>
Subject: Re: [dpdk-dev] [PATCH] net/ice: fix missed pointer checkQuoted 24 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Wenzhuo Lu
Sent: Tuesday, November 10, 2020 6:46 AM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>
Subject: [dpdk-dev] [PATCH] net/ice: fix missed pointer checkThe return value of
rte_mempool_default_cacheshould be checked as it can be NULL.Fixes a4e480de268e ("net/ice: optimize Tx by using AVX512")Reported-by Konstantin Ananyev <[email protected]>Signed-off-by Wenzhuo Lu <[email protected]>--- drivers/net/ice/ice_rxtx_vec_avx512.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)drivers/net/ice/ice_rxtx_vec_avx512.c +0
-0drivers/net/ice/ice_rxtx_vec_avx512.c line 782
Quoted 2 lines
drivers/net/ice/ice_rxtx_vec_avx512.c +0
-0@@ -781,9 +781,14 @@if (txq->offloads &DEV_TX_OFFLOAD_MBUF_FAST_FREE && (n &31 ) ==0 ){
drivers/net/ice/ice_rxtx_vec_avx512.c
Quoted 3 lines
drivers/net/ice/ice_rxtx_vec_avx512.c +1
-0struct rte_mempool *mp = txep[0 ].mbuf->pool; +void **cache_objs; struct rte_mempool_cache *cache =rte_mempool_default_cache(mp,
drivers/net/ice/ice_rxtx_vec_avx512.c
Quoted 10 lines
drivers/net/ice/ice_rxtx_vec_avx512.c +5
-1rte_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
Quoted 4 lines
+826,7 @@
drivers/net/ice/ice_rxtx_vec_avx512.c +0
-0goto done; }
Quoted 7 lines
drivers/net/ice/ice_rxtx_vec_avx512.c
Quoted 5 lines
drivers/net/ice/ice_rxtx_vec_avx512.c +1
-1+normal: m =rte_pktmbuf_prefree_seg (txep[0 ].mbuf);if (likely (m)) { free[0 ] = m; --
Applied to dpdk-next-net-intel.
Thanks
Qi
Quoted 2 lines
Quoted 2 lines
1.9.3