diff mbox series

isdn: avm: Handle return value of skb_dequeue()

Message ID 5818ec104ed4354db3625ac8c7741d771719e4d4.1513453258.git.arvind.yadav.cs@gmail.com
State Rejected, archived
Delegated to: David Miller
Headers show
Series isdn: avm: Handle return value of skb_dequeue() | expand

Commit Message

Arvind Yadav Dec. 16, 2017, 7:47 p.m. UTC
skb_dequeue() will return NULL for an empty list or a pointer
to the head element.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/isdn/hardware/avm/b1dma.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

David Miller Dec. 19, 2017, 4:04 p.m. UTC | #1
From: Arvind Yadav <arvind.yadav.cs@gmail.com>
Date: Sun, 17 Dec 2017 01:17:23 +0530

> skb_dequeue() will return NULL for an empty list or a pointer
> to the head element.
> 
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>

There is no code path where this is possible.

The two call sites:

1) Explicitly add an SKB to the queue

OR

2) Explcitily guard the call with an skb_queue_empty() check

Therefore the stated condition is not possible.
diff mbox series

Patch

diff --git a/drivers/isdn/hardware/avm/b1dma.c b/drivers/isdn/hardware/avm/b1dma.c
index 9538a9e..10df578 100644
--- a/drivers/isdn/hardware/avm/b1dma.c
+++ b/drivers/isdn/hardware/avm/b1dma.c
@@ -375,6 +375,8 @@  static void b1dma_dispatch_tx(avmcard *card)
 	void *p;
 
 	skb = skb_dequeue(&dma->send_queue);
+	if (!skb)
+		return;
 
 	len = CAPIMSG_LEN(skb->data);