Skip to contentSkip to conversation

net: hsr: remove an redundant null check before kfree_skb

PATCH In review zhong jiang 2 participants 3 messages Sep 4, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: hsr: remove an redundant null check before kfree_skb

kfree_skb has taken the null pointer into account. Hence just remove the null check before kfree_skb.

---
 net/hsr/hsr_forward.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
net/hsr/hsr_forward.c +2 -4
index ddd9605..0c9e5b0 100644
@@ -367,10 +367,8 @@ void hsr_forward_skb(struct sk_buff *skb, struct hsr_port *port)
 		port->dev->stats.tx_bytes += skb->len;
 	}
 
-	if (frame.skb_hsr)
-		kfree_skb(frame.skb_hsr);
-	if (frame.skb_std)
-		kfree_skb(frame.skb_std);
+	kfree_skb(frame.skb_hsr);
+	kfree_skb(frame.skb_std);
 	return;
 
 out_drop:
Signature · 1 line
1.7.12.4
#1 lore raw

Re: net: hsr: remove a redundant null check before kfree_skb

Quoted 1 line

kfree_skb has taken the null pointer into account.

I suggest to take another look also at information around a similar update suggestion.

net-hsr: Delete unnecessary checks before the function call "kfree_skb"
https://lkml.org/lkml/2015/11/14/120
https://lore.kernel.org/patchwork/patch/617878/
https://lore.kernel.org/r/[email protected]/

https://lkml.org/lkml/2015/11/24/433
https://lore.kernel.org/r/[email protected]/

Regards,
Markus

#2 lore raw

Re: net: hsr: remove a redundant null check before kfree_skb

Quoted 11 lines · Markus Elfring
Quoted 1 line

kfree_skb has taken the null pointer into account.

I suggest to take another look also at information around a similar update suggestion.

net-hsr: Delete unnecessary checks before the function call "kfree_skb"
https://lkml.org/lkml/2015/11/14/120
https://lore.kernel.org/patchwork/patch/617878/
https://lore.kernel.org/r/[email protected]/

https://lkml.org/lkml/2015/11/24/433
https://lore.kernel.org/r/[email protected]/

Thanks you for explaination. I miss the similar patch before sending it.

Sincerely,
zhong jiang

Quoted 5 lines

Regards,
Markus

.