From: Gustavo A. R. Silva Date: Thu, 26 Oct 2017 12:51:06 +0000 (-0500) Subject: ipv6: esp6: use BUG_ON instead of if condition followed by BUG X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=eee12df5a0bd5769af5efb72fa95dd1f633a266c;p=linux.git ipv6: esp6: 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. Signed-off-by: Gustavo A. R. Silva Acked-by: Herbert Xu Signed-off-by: Steffen Klassert --- diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c index 1696401fed6cb..4000b71bfdc57 100644 --- a/net/ipv6/esp6.c +++ b/net/ipv6/esp6.c @@ -483,8 +483,8 @@ static inline int esp_remove_trailer(struct sk_buff *skb) goto out; } - if (skb_copy_bits(skb, skb->len - alen - 2, nexthdr, 2)) - BUG(); + ret = skb_copy_bits(skb, skb->len - alen - 2, nexthdr, 2); + BUG_ON(ret); ret = -EINVAL; padlen = nexthdr[0];