Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3800971imm; Tue, 11 Sep 2018 02:13:44 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZJ1BHHGfyU6Dwxd4DZypUSHBG0Z9ixZmL/dL4DfOBoLxgaqBKi0lTT+Mhmzo1bNecb9UJn X-Received: by 2002:a62:e008:: with SMTP id f8-v6mr28387394pfh.208.1536657224244; Tue, 11 Sep 2018 02:13:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536657224; cv=none; d=google.com; s=arc-20160816; b=RAX2SONObnTqeaGXnVhQKmILMMyvj0iI6F0N89mHj2rOXKcDZ3DDdOcBzXcxPtAOlH d4ziucw8SNs7sCWeb3Vmj5t1JmhujWNfxOhLAEA4ccp5GFVzGMuWXJJu6SWJFQGlve6y OTjhgNP8dclxAjjqpeLwwC9K+L8nUBWxR5jXbOhRr2X2mG6hNjlX+iadEg3hXZ50Ws4H sPNJEZh6nQXu4mpNTRKIWIRbN2IRmt24AtdlqSok4Nv889BNEPHXaRRwoZfN+tGfhtDF V02K2WL7manbE8M8GQtTvS3QUakLawDQdA0/UsrXfaDryP8opQ8am7Mwumg2VDJIVyls XGig== 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=+hRAOXX/4WlwteZOPt1nnGT9PlqvrgoiHbGp2lkPGBo=; b=WQVCWfiuQNWad16pqQdk9kx1D4CadTjHVUsFBywYsZdRDnvj9Ly15F/798riUEiymr D1rTMyzl68FPWFuwNrJK3dwCVlbsFQJ+ujnG5PD89e9jz1BBPjythKKKd6/y95PWnmqk TVaG0A300GvDJ1Tge9MERyeP5LTY5PYq3gwib3nER+91VtkwEIJiZLnKUhDuEj1T3IHi cgaNZDJM2Zmxp4mglomijUe+lUpvA9kXBbLZc+8UUZ/pooXiRw29cViGvyrBm7m9umtB 18jEfvnblPLxWSk6eUTgnXpPD827qwB08d7MwXmK5XvYa0G/MNow1BqjNKqJETpGyxnB hvfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cogentembedded-com.20150623.gappssmtp.com header.s=20150623 header.b=hF6BsDz0; 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 j10-v6si19967067plg.143.2018.09.11.02.13.29; Tue, 11 Sep 2018 02:13:44 -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=hF6BsDz0; 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 S1727152AbeIKOKM (ORCPT + 99 others); Tue, 11 Sep 2018 10:10:12 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:44755 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726572AbeIKOKL (ORCPT ); Tue, 11 Sep 2018 10:10:11 -0400 Received: by mail-lj1-f195.google.com with SMTP id q127-v6so20227906ljq.11 for ; Tue, 11 Sep 2018 02:11:47 -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=+hRAOXX/4WlwteZOPt1nnGT9PlqvrgoiHbGp2lkPGBo=; b=hF6BsDz0OX5HjWlIZ0RgtL1Dqwe0+mn+crKjZcsw0RpFrqczGvogSK3OL8CzBbCIuC /O4da5nzxwGpw4aHBLyMqIJ+nqLGXZQUXvHNn3SJ731jxRx5QUoLyJBhzOMSv6TMViiz jrqp8sJTAgrYPTeeP1aNo1uYoBQk/qq0vB3jxgKr3ck942EKGg71aKlqLoI9gni6y7WG zVZ5lgi5e378PpnKIbShRvTBcDHLguyFLbotMLdDEgWa96yIlI8ujm8v8sHpOoKUNuD4 jS18IdY7BNbxc11QVmqFgvpYE1100DPAIWsFc+0ymBdMVULixI+oBLDxZyHb/5Nrvzji U+OA== 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=+hRAOXX/4WlwteZOPt1nnGT9PlqvrgoiHbGp2lkPGBo=; b=YINoAMfjbb5pgZsWa2GlinEoaSlfTCjjiFAZi3Qs04nVliiLpnw9KesgsIB4JX6GjG acM/wTX+pRFSDWvvUwUrwjWD9LodnWxUfHKrUKr75t2hn5ylyAVzA/lsk5Kp5+Q6uIM7 k1Yb1BHrvSzCjkli9jRLwLMANoqmUJx8Zdu5xJUnDVaVeIAoYVBsNoIg3SrAEVIEUvkS c32wNLgMeYtJ9IRRegtdwl4Cq6spTzBrB83wtTDMB7P8OxhPh/BoRp1I2m6+HXIujBsO Q7ZZ1x+SxAHrpEizsRNdOiX2Khd0JzpBRxmr+1MrOpGxa2OebsFyhGRZ/88SL9TYfv6K Hzmw== X-Gm-Message-State: APzg51CAnInmgNSdSBAxE+O/IjLXYgR0ycGqhX05dF/LbfEXb5tNHeov 1G2IPMd/4vSiD5ZgBh9MYCM/Rb1fVzk= X-Received: by 2002:a2e:9b59:: with SMTP id o25-v6mr8312076ljj.132.1536657106467; Tue, 11 Sep 2018 02:11:46 -0700 (PDT) Received: from [192.168.0.126] ([31.173.81.2]) by smtp.gmail.com with ESMTPSA id 13-v6sm3170484lfy.87.2018.09.11.02.11.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Sep 2018 02:11:45 -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> From: Sergei Shtylyov Message-ID: Date: Tue, 11 Sep 2018 12:11:45 +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: <5B9783ED.4080908@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 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 >>> --- >>> 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