All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] falcon: pass valid pointer from ef4_enqueue_unwind.
@ 2019-05-29  2:15 Young Xiao
  2019-05-30 18:45 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Young Xiao @ 2019-05-29  2:15 UTC (permalink / raw)
  To: ecree, mhabets, davem, fw, netdev, linux-kernel; +Cc: Young Xiao

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.

Signed-off-by: Young Xiao <92siuyang@gmail.com>
---
 drivers/net/ethernet/sfc/falcon/tx.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/sfc/falcon/tx.c b/drivers/net/ethernet/sfc/falcon/tx.c
index c5059f4..ed89bc6 100644
--- a/drivers/net/ethernet/sfc/falcon/tx.c
+++ b/drivers/net/ethernet/sfc/falcon/tx.c
@@ -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);
 	}
 }
 
-- 
2.7.4


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

* Re: [PATCH] falcon: pass valid pointer from ef4_enqueue_unwind.
  2019-05-29  2:15 [PATCH] falcon: pass valid pointer from ef4_enqueue_unwind Young Xiao
@ 2019-05-30 18:45 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-05-30 18:45 UTC (permalink / raw)
  To: 92siuyang; +Cc: ecree, mhabets, fw, netdev, linux-kernel

From: Young Xiao <92siuyang@gmail.com>
Date: Wed, 29 May 2019 10:15:39 +0800

> 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.
> 
> Signed-off-by: Young Xiao <92siuyang@gmail.com>

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

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

end of thread, other threads:[~2019-05-30 18:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-29  2:15 [PATCH] falcon: pass valid pointer from ef4_enqueue_unwind Young Xiao
2019-05-30 18:45 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.