Skip to contentSkip to conversation

ipv4: esp4: use BUG_ON instead of if condition followed by BUG

PATCH In review Gustavo A. R. Silva 2 participants 2 messages Oct 23, 2017 – Oct 24, 2017

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

PATCH 1/1 ipv4: esp4: use BUG_ON instead of if condition followed by BUG

Use BUG_ON instead of if condition followed by BUG in esp_remove_trailer.

This issue was detected with the help of Coccinelle.

---
 net/ipv4/esp4.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
net/ipv4/esp4.c +1 -2
index b00e4a4..89b6c5e 100644
@@ -521,8 +521,7 @@ static inline int esp_remove_trailer(struct sk_buff *skb)
 		goto out;
 	}
 
-	if (skb_copy_bits(skb, skb->len - alen - 2, nexthdr, 2))
-		BUG();
+	BUG_ON(skb_copy_bits(skb, skb->len - alen - 2, nexthdr, 2));
 
 	ret = -EINVAL;
 	padlen = nexthdr[0];
Signature · 1 line
2.7.4
#1 lore raw
Quoted 12 lines

Subject: [PATCH] ipv4: esp4: use BUG_ON instead of if condition followed by BUG

Use BUG_ON instead of if condition followed by BUG in esp_remove_trailer.

This issue was detected with the help of Coccinelle.

---
 net/ipv4/esp4.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Please consider esp6 as well.