Skip to content

Commit 058c8d5

Browse files
GustavoARSilvadavem330
authored andcommitted
net: core: rtnetlink: use BUG_ON instead of if condition followed by BUG
Use BUG_ON instead of if condition followed by BUG in do_setlink. This issue was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent e83b171 commit 058c8d5

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

net/core/rtnetlink.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2274,8 +2274,7 @@ static int do_setlink(const struct sk_buff *skb,
22742274

22752275
rcu_read_lock();
22762276

2277-
if (!(af_ops = rtnl_af_lookup(nla_type(af))))
2278-
BUG();
2277+
BUG_ON(!(af_ops = rtnl_af_lookup(nla_type(af))));
22792278

22802279
err = af_ops->set_link_af(dev, af);
22812280
if (err < 0) {

0 commit comments

Comments
 (0)