lkml.org 
[lkml]   [2017]   [Oct]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH] 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>
    ---
    This code was tested by compilation only.

    net/core/rtnetlink.c | 3 +--
    1 file changed, 1 insertion(+), 2 deletions(-)

    diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
    index 04680a5..df8dba9 100644
    --- a/net/core/rtnetlink.c
    +++ b/net/core/rtnetlink.c
    @@ -2274,8 +2274,7 @@ static int do_setlink(const struct sk_buff *skb,

    rcu_read_lock();

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

    err = af_ops->set_link_af(dev, af);
    if (err < 0) {
    --
    2.7.4
    \
     
     \ /
      Last update: 2017-10-22 17:47    [W:5.135 / U:0.012 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site