mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: zhong jiang <zhongjiang@huawei.com>
Cc: davem@davemloft.net, edumazet@google.com, kuznet@ms2.inr.ac.ru,
	yoshfuji@linux-ipv6.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: ipv4: Use BUG_ON directly instead of a if condition followed by BUG
Date: Tue, 11 Sep 2018 12:11:45 +0300	[thread overview]
Message-ID: <e1b9c36c-5459-a68e-e6fd-cca038e31d5f@cogentembedded.com> (raw)
In-Reply-To: <5B9783ED.4080908@huawei.com>

On 9/11/2018 11:59 AM, zhong jiang wrote:

>>> The if condition can be removed if we use BUG_ON directly.
>>> The issule is detected with the help of Coccinelle.
>>
>>    Issue?
>>
>>>
>>> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
>>> ---
>>>    net/ipv4/tcp_input.c | 8 ++++----
>>>    1 file changed, 4 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
>>> index 62508a2..893bde3 100644
>>> --- a/net/ipv4/tcp_input.c
>>> +++ b/net/ipv4/tcp_input.c
>>> @@ -4934,8 +4934,8 @@ void tcp_rbtree_insert(struct rb_root *root, struct sk_buff *skb)
>>>                BUG_ON(offset < 0);
>>>                if (size > 0) {
>>>                    size = min(copy, size);
>>> -                if (skb_copy_bits(skb, offset, skb_put(nskb, size), size))
>>> -                    BUG();
>>> +                BUG(skb_copy_bits(skb, offset,
>>
>>     You said BUG_ON()?
>   Yep. Do you think that it is worthing to do

    I think BUG() doesn't take parameters, BUG_ON() does. Have you tried to 
build the kernel with your patch at all?

>   Thanks,
> zhong jiang
[...]

MBR, Sergei


  reply	other threads:[~2018-09-11  9:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-10 14:38 zhong jiang
2018-09-10 15:39 ` Jiri Benc
2018-09-11  1:12   ` zhong jiang
2018-09-10 20:23 ` kbuild test robot
2018-09-10 21:20 ` kbuild test robot
2018-09-11  8:51 ` Sergei Shtylyov
2018-09-11  8:59   ` zhong jiang
2018-09-11  9:11     ` Sergei Shtylyov [this message]
2018-09-11  9:19       ` zhong jiang
2018-09-11  9:33         ` Sergei Shtylyov
2018-09-12  6:54 ` David Miller
2018-09-12 13:25   ` zhong jiang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e1b9c36c-5459-a68e-e6fd-cca038e31d5f@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=yoshfuji@linux-ipv6.org \
    --cc=zhongjiang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome