ipv6: esp6: use BUG_ON instead of if condition followed by BUG
authorGustavo A. R. Silva <garsilva@embeddedor.com>
Thu, 26 Oct 2017 12:51:06 +0000 (07:51 -0500)
committerSteffen Klassert <steffen.klassert@secunet.com>
Fri, 27 Oct 2017 06:02:00 +0000 (08:02 +0200)
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>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
net/ipv6/esp6.c

index 1696401fed6cbc0c9b6a57fd854bd3e5c309540a..4000b71bfdc5757c554e8964722417cad1a729e1 100644 (file)
@@ -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];