瀏覽代碼

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 <garsilva@embeddedor.com>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Gustavo A. R. Silva 7 年之前
父節點
當前提交
eee12df5a0
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      net/ipv6/esp6.c

+ 2 - 2
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];