Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

af_key: make use of BUG_ON macro

fix below warnings reported by coccicheck

net/key/af_key.c:932:2-5: WARNING: Use BUG_ON instead of if condition
followed by BUG.
net/key/af_key.c:948:2-5: WARNING: Use BUG_ON instead of if condition
followed by BUG.

Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Hariprasad Kelam and committed by
David S. Miller
de47c5d8 39209673

+2 -4
+2 -4
net/key/af_key.c
··· 928 928 pfkey_sockaddr_fill(&x->props.saddr, 0, 929 929 (struct sockaddr *) (addr + 1), 930 930 x->props.family); 931 - if (!addr->sadb_address_prefixlen) 932 - BUG(); 931 + BUG_ON(!addr->sadb_address_prefixlen); 933 932 934 933 /* dst address */ 935 934 addr = skb_put(skb, sizeof(struct sadb_address) + sockaddr_size); ··· 943 944 pfkey_sockaddr_fill(&x->id.daddr, 0, 944 945 (struct sockaddr *) (addr + 1), 945 946 x->props.family); 946 - if (!addr->sadb_address_prefixlen) 947 - BUG(); 947 + BUG_ON(!addr->sadb_address_prefixlen); 948 948 949 949 if (!xfrm_addr_equal(&x->sel.saddr, &x->props.saddr, 950 950 x->props.family)) {