Skip to contentSkip to conversation

falcon: pass valid pointer from ef4_enqueue_unwind.

PATCH In review Young Xiao 2 participants 2 messages May 29, 2019 – May 30, 2019

Subsystems (3)
lore
Share & tools
lore

Young Xiao

author
#0 lore raw

PATCH 1/1 falcon: pass valid pointer from ef4_enqueue_unwind.

The bytes_compl and pkts_compl pointers passed to ef4_dequeue_buffers cannot be NULL. Add a paranoid warning to check this condition and fix the one case where they were NULL.

---
 drivers/net/ethernet/sfc/falcon/tx.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/sfc/falcon/tx.c +4 -1
index c5059f4..ed89bc6 100644
@@ -69,6 +69,7 @@ static void ef4_dequeue_buffer(struct ef4_tx_queue *tx_queue,
 	}
 
 	if (buffer->flags & EF4_TX_BUF_SKB) {
+		EF4_WARN_ON_PARANOID(!pkts_compl || !bytes_compl);
 		(*pkts_compl)++;
 		(*bytes_compl) += buffer->skb->len;
 		dev_consume_skb_any((struct sk_buff *)buffer->skb);
@@ -271,12 +272,14 @@ static int ef4_tx_map_data(struct ef4_tx_queue *tx_queue, struct sk_buff *skb)
 static void ef4_enqueue_unwind(struct ef4_tx_queue *tx_queue)
 {
 	struct ef4_tx_buffer *buffer;
+	unsigned int bytes_compl = 0;
+	unsigned int pkts_compl = 0;
 
 	/* Work backwards until we hit the original insert pointer value */
 	while (tx_queue->insert_count != tx_queue->write_count) {
 		--tx_queue->insert_count;
 		buffer = __ef4_tx_queue_get_insert_buffer(tx_queue);
-		ef4_dequeue_buffer(tx_queue, buffer, NULL, NULL);
+		ef4_dequeue_buffer(tx_queue, buffer, &pkts_compl, &bytes_compl);
 	}
 }
 
Signature · 1 line
2.7.4
maintainer
#1 lore raw

From: Young Xiao <[email protected]>
Date: Wed, 29 May 2019 10:15:39 +0800

Quoted 5 lines

The bytes_compl and pkts_compl pointers passed to ef4_dequeue_buffers cannot be NULL. Add a paranoid warning to check this condition and fix the one case where they were NULL.

EF4_TX_BUF_SKB will be clear in this situation, so your patch is not necessary.