Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3818963imm; Tue, 11 Sep 2018 02:34:17 -0700 (PDT) X-Google-Smtp-Source: ANB0VdawCNIVuOvMIOyReqsMpRnZ5JdrE5Dlkm4SoUP/9VwyjJ6LkGDryk0rBKDUUVemCSIeGE7z X-Received: by 2002:a62:1605:: with SMTP id 5-v6mr28545020pfw.11.1536658457194; Tue, 11 Sep 2018 02:34:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536658457; cv=none; d=google.com; s=arc-20160816; b=kzJQEuPUorOLghP913k5xPNNc8eQ3lrFF5MisVZGRhog5slq44WWKK7M9MoOd35i0E jQ/t4rrdirLqBpy9IJBIDSJv0OOSYfWAg7AN01oUAHkSHdAXn215KQLht49zMv/MbP4B He+wyK4iXJXjgC2TjgLI6/PZIAodCezxunos2qCdAA7fC0xs6T/wcq5HzpjVR9ZjSPfD 5eaO7/mfDihVBl5iseBZvp60+2wfxjBEp/iU5HHl89prJ+EAa0vVtiHCOlOG/zCfwlap BiiTZLn6oksGKfxK2iz3dso0rHZIZqYfvQk4hUdXJiN16DvKUgzPSyKZNybcop/8MF0r A30A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=0CqYcvNpE16qWp6cyTlBFDC525iQJL/z/iPpsZsoLnU=; b=Ppra8nLhkFROeXg7o0xqXEYRyD8KsRRf+e6LaUVCyKJt8IUp+C+oSutwfJF+EIkuEB dQpKPqXVPQOkY3dZWVYEBz3pwfmILEuLvn/TkFEegPCLYeSGiTFZ8pd9ANbgmXuuLt4V fC3GqCrx/jN1EGUbl/yyL0qPnKykR5xdjszA3wsrccG2BMXW5sv3gtK4b0/hEQ0PZWyj Wmf1hDslDJANsh04RQJhiR0aXNGMPJcsnTVrr+B4MUr+zyNhLvIUH8Ein0Rr5xpu/7tz UNYJRfqEfN3CQW4ellf0XVDTMFVkbV5CbZSaxgROcobzS4C8unBlzjl0yVjwSJqxSk0v VZwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cogentembedded-com.20150623.gappssmtp.com header.s=20150623 header.b="voBqe/xe"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d37-v6si19508314pla.40.2018.09.11.02.33.19; Tue, 11 Sep 2018 02:34:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@cogentembedded-com.20150623.gappssmtp.com header.s=20150623 header.b="voBqe/xe"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727004AbeIKObb (ORCPT + 99 others); Tue, 11 Sep 2018 10:31:31 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:37475 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726670AbeIKObb (ORCPT ); Tue, 11 Sep 2018 10:31:31 -0400 Received: by mail-lf1-f67.google.com with SMTP id j8-v6so19757556lfb.4 for ; Tue, 11 Sep 2018 02:33:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cogentembedded-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=0CqYcvNpE16qWp6cyTlBFDC525iQJL/z/iPpsZsoLnU=; b=voBqe/xeMSMqQWr1lYdewUzYWyrXWEUafoHvsXy+MYwMtmUdis0BWHKHzcYKCTBGMN mGjVVIHa+hQDcsrrXW3N1r9hWwn27648SCxzMkuEd7a+idYJgfD0cfNgrmE6ZmzXo3BA YU8lJRe5cjd0DrZVbzFUXJEiWcUKQMcGz7VZVZuQYI7u7wmym4mfUn2z1yN1Dwr3zTwe AWi7s8ySUHeGAquL8nS/1z7KWFjvgB8Mb2+bBQppVzPeLrZ71ucSbCIDjWEKlsRZ37zF I00Na0+3xmJPHMe+FhhPuB2Pcyg6W4plEOu8AnUvnpbI2rO4wdjAMY3T8KWj0/h+Fcd5 NAcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=0CqYcvNpE16qWp6cyTlBFDC525iQJL/z/iPpsZsoLnU=; b=iCwXBFLInY25J36Yp7Hdx+UyfUbCh6Ku2OkpvQ48QgnnVPXipYmCvmNftx8+UqAZOZ Iv56yNgL1SpY17bEVnGTnQQkto3MTmHBBn3OwzcKGMDHlWQFhyAWgBAv5yiHOuMa1Khq C/HwpXGhuDsmYsUiLd4xBTiQ00Obnee3GDK67jxPphPyGjOGe5kbHBuCmt8qk2R4k0tG Ae+GSunye9PUTIF7FxXAZ9JjWo0Orr1bA6Uc38bJNozDZKjXcfY7y2sPktNva2KTmanQ ZGbczJU+LWcHNBbYvYn6wV123dW0Y2wQeQuQzPUcU/SUjadrGkrEGRU5QtXzvd+2CN3q wkzw== X-Gm-Message-State: APzg51BM503/Y7r4z141W71+H/ZaO1xWZmHsWxuvL7JTbxCKbsZnTA6Y wmC6IrdwhvuEoEJbJ/jffnMrQvOcgno= X-Received: by 2002:a19:cc08:: with SMTP id c8-v6mr15761672lfg.145.1536658380729; Tue, 11 Sep 2018 02:33:00 -0700 (PDT) Received: from [192.168.0.126] ([31.173.81.2]) by smtp.gmail.com with ESMTPSA id u2-v6sm3205691ljg.55.2018.09.11.02.32.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Sep 2018 02:32:59 -0700 (PDT) Subject: Re: [PATCH] net: ipv4: Use BUG_ON directly instead of a if condition followed by BUG To: zhong jiang 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 References: <1536590282-23899-1-git-send-email-zhongjiang@huawei.com> <5B9783ED.4080908@huawei.com> <5B97889F.3020303@huawei.com> From: Sergei Shtylyov Message-ID: <6a9ff302-c86c-cd9e-7432-2de38d148678@cogentembedded.com> Date: Tue, 11 Sep 2018 12:33:00 +0300 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <5B97889F.3020303@huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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