From: zhong jiang <zhongjiang@huawei.com>
To: Sergei Shtylyov <sergei.shtylyov@cogentembedded.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 17:19:27 +0800 [thread overview]
Message-ID: <5B97889F.3020303@huawei.com> (raw)
In-Reply-To: <e1b9c36c-5459-a68e-e6fd-cca038e31d5f@cogentembedded.com>
On 2018/9/11 17:11, Sergei Shtylyov wrote:
> 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?
>
I know that the patch should be BUG_ON instead of BUG. This is my mistake. I just want to know that it is worthing to do so.
Thanks,
zhong jiang
>> Thanks,
>> zhong jiang
> [...]
>
> MBR, Sergei
>
>
>
next prev parent reply other threads:[~2018-09-11 9:19 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-10 14:38 [PATCH] net: ipv4: Use BUG_ON directly instead of a if condition followed by BUG 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
2018-09-11 9:19 ` zhong jiang [this message]
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=5B97889F.3020303@huawei.com \
--to=zhongjiang@huawei.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=sergei.shtylyov@cogentembedded.com \
--cc=yoshfuji@linux-ipv6.org \
/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;
as well as URLs for NNTP newsgroup(s).