DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [v2] drivers/net: fix dereference after null check coverity
@ 2019-07-15 12:15 Xiao Zhang
  2019-07-16 11:55 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
  0 siblings, 1 reply; 7+ messages in thread
From: Xiao Zhang @ 2019-07-15 12:15 UTC (permalink / raw)
  To: dev
  Cc: qi.z.zhang, xiao.w.wang, beilei.xing, wenzhuo.lu, qiming.yang,
	Xiao Zhang, stable

This patch tries to fix the coverity issues of dereference after null
check.
The addresses of receive queue start segment for ice, avf, i40e, 
fm10k and ixgb were not checked before use. Add check to avoid
coverity issues.

Coverity issue: 343452
Coverity issue: 343407
Fixes: c68a52b8 ("net/ice: support vector SSE in Rx")
Coverity issue: 343447
Fixes: 319c421f ("net/avf: enable SSE Rx Tx")
Coverity issue: 343422
Coverity issue: 343403
Fixes: ca74903b ("net/i40e: extract non-x86 specific code from vector driver")
Coverity issue: 343416
Fixes: fe65e1e1 ("fm10k: add vector scatter Rx")
Coverity issue: 13245
Fixes: 8a44c15a ("net/ixgbe: extract non-x86 specific code from vector driver")
Cc: stable@dpdk.org

Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
---
v2 changes:
* update commit log with fixes information.

 drivers/net/fm10k/fm10k_rxtx_vec.c        | 3 +++
 drivers/net/i40e/i40e_rxtx_vec_common.h   | 3 +++
 drivers/net/iavf/iavf_rxtx_vec_common.h   | 3 +++
 drivers/net/ice/ice_rxtx_vec_common.h     | 3 +++
 drivers/net/ixgbe/ixgbe_rxtx_vec_common.h | 3 +++
 5 files changed, 15 insertions(+)

diff --git a/drivers/net/fm10k/fm10k_rxtx_vec.c b/drivers/net/fm10k/fm10k_rxtx_vec.c
index 788e248..cb840de 100644
--- a/drivers/net/fm10k/fm10k_rxtx_vec.c
+++ b/drivers/net/fm10k/fm10k_rxtx_vec.c
@@ -602,6 +602,9 @@ fm10k_reassemble_packets(struct fm10k_rx_queue *rxq,
 	struct rte_mbuf *end =  rxq->pkt_last_seg;
 	unsigned pkt_idx, buf_idx;
 
+	if (!start)
+		return 0;
+
 	for (buf_idx = 0, pkt_idx = 0; buf_idx < nb_bufs; buf_idx++) {
 		if (end != NULL) {
 			/* processing a split packet */
diff --git a/drivers/net/i40e/i40e_rxtx_vec_common.h b/drivers/net/i40e/i40e_rxtx_vec_common.h
index 0e6ffa0..1351e41 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_common.h
+++ b/drivers/net/i40e/i40e_rxtx_vec_common.h
@@ -20,6 +20,9 @@ reassemble_packets(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_bufs,
 	struct rte_mbuf *end =  rxq->pkt_last_seg;
 	unsigned pkt_idx, buf_idx;
 
+	if (!start)
+		return 0;
+
 	for (buf_idx = 0, pkt_idx = 0; buf_idx < nb_bufs; buf_idx++) {
 		if (end != NULL) {
 			/* processing a split packet */
diff --git a/drivers/net/iavf/iavf_rxtx_vec_common.h b/drivers/net/iavf/iavf_rxtx_vec_common.h
index db509d7..ac3d62a 100644
--- a/drivers/net/iavf/iavf_rxtx_vec_common.h
+++ b/drivers/net/iavf/iavf_rxtx_vec_common.h
@@ -20,6 +20,9 @@ reassemble_packets(struct iavf_rx_queue *rxq, struct rte_mbuf **rx_bufs,
 	struct rte_mbuf *end =  rxq->pkt_last_seg;
 	unsigned int pkt_idx, buf_idx;
 
+	if (!start)
+		return 0;
+
 	for (buf_idx = 0, pkt_idx = 0; buf_idx < nb_bufs; buf_idx++) {
 		if (end) {
 			/* processing a split packet */
diff --git a/drivers/net/ice/ice_rxtx_vec_common.h b/drivers/net/ice/ice_rxtx_vec_common.h
index c5f0d56..11da521 100644
--- a/drivers/net/ice/ice_rxtx_vec_common.h
+++ b/drivers/net/ice/ice_rxtx_vec_common.h
@@ -16,6 +16,9 @@ ice_rx_reassemble_packets(struct ice_rx_queue *rxq, struct rte_mbuf **rx_bufs,
 	struct rte_mbuf *end =  rxq->pkt_last_seg;
 	unsigned int pkt_idx, buf_idx;
 
+	if (!start)
+		return 0;
+
 	for (buf_idx = 0, pkt_idx = 0; buf_idx < nb_bufs; buf_idx++) {
 		if (end) {
 			/* processing a split packet */
diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h b/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h
index a97c271..a95cc0a 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h
+++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h
@@ -19,6 +19,9 @@ reassemble_packets(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_bufs,
 	struct rte_mbuf *end =  rxq->pkt_last_seg;
 	unsigned int pkt_idx, buf_idx;
 
+	if (!start)
+		return 0;
+
 	for (buf_idx = 0, pkt_idx = 0; buf_idx < nb_bufs; buf_idx++) {
 		if (end != NULL) {
 			/* processing a split packet */
-- 
2.7.4


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-07-17  1:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-15 12:15 [dpdk-dev] [v2] drivers/net: fix dereference after null check coverity Xiao Zhang
2019-07-16 11:55 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
2019-07-16 12:19   ` Zhang, Xiao
2019-07-16 14:26     ` Ferruh Yigit
2019-07-16 14:35       ` Zhang, Xiao
2019-07-16 14:45         ` Ferruh Yigit
2019-07-17  1:47           ` Zhang, Xiao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).