netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ipv6: esp6: use BUG_ON instead of if condition followed by BUG
@ 2017-10-24 16:28 Gustavo A. R. Silva
  2017-10-25  4:07 ` Herbert Xu
  0 siblings, 1 reply; 6+ messages in thread
From: Gustavo A. R. Silva @ 2017-10-24 16:28 UTC (permalink / raw)
  To: Steffen Klassert, Herbert Xu, David S. Miller, Alexey Kuznetsov,
	Hideaki YOSHIFUJI
  Cc: netdev, linux-kernel, Gustavo A. R. Silva

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

This issue was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
 net/ipv6/esp6.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
index 89910e2..603ff06 100644
--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -483,8 +483,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];
-- 
2.7.4

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

end of thread, other threads:[~2017-10-27 10:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-24 16:28 [PATCH] ipv6: esp6: use BUG_ON instead of if condition followed by BUG Gustavo A. R. Silva
2017-10-25  4:07 ` Herbert Xu
2017-10-26 12:51   ` [PATCH v2] " Gustavo A. R. Silva
2017-10-26 22:38     ` Herbert Xu
2017-10-27  4:12       ` Gustavo A. R. Silva
2017-10-27 10:46       ` Steffen Klassert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).