From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sergei Shtylyov Subject: Re: [PATCH] net: ipv4: Use BUG_ON directly instead of a if condition followed by BUG Date: Tue, 11 Sep 2018 12:33:00 +0300 Message-ID: <6a9ff302-c86c-cd9e-7432-2de38d148678@cogentembedded.com> References: <1536590282-23899-1-git-send-email-zhongjiang@huawei.com> <5B9783ED.4080908@huawei.com> <5B97889F.3020303@huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit 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 To: zhong jiang Return-path: Received: from mail-lf1-f66.google.com ([209.85.167.66]:36581 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726554AbeIKOba (ORCPT ); Tue, 11 Sep 2018 10:31:30 -0400 Received: by mail-lf1-f66.google.com with SMTP id x207-v6so19802352lff.3 for ; Tue, 11 Sep 2018 02:33:01 -0700 (PDT) In-Reply-To: <5B97889F.3020303@huawei.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 9/11/2018 12:19 PM, 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 >>>>> --- >>>>> 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. Yes, probably. > Thanks, > zhong jiang [...] MBR, Sergei