Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3806709imm; Tue, 11 Sep 2018 02:20:09 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdas8RQnZosT5rfx23bf2cv2QbhNTLQhGmeYnIGnoyaOj5e7wV3k3982yfRdp6bWm7UrsNNv X-Received: by 2002:a17:902:e85:: with SMTP id 5-v6mr25417970plx.73.1536657609323; Tue, 11 Sep 2018 02:20:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536657609; cv=none; d=google.com; s=arc-20160816; b=rl7bIdCfFOlWhgPpxEnPeC1NuASgtn7yQySQH/tqghN7dc5+TqiTVsIx1FBcZO/Qbp hKD88ziPvgKcZkVg4dlwRVCel/oZ/2Jt4/Qk+ZdmLi/5PbWScRnNt514ZWP0y0vOsWl+ W2YEBgGkMUwsCsP89rHg4ubnpzTDTtsV5RgBcQmLZn1ebu+3L8mKc5Abxf6GGegWBB4+ TR8HlXV2oXC9drB2dFOMlg8M3lGbRxNlqhSwxMz6H8n5ufBMtk+gTMoqrskRgcoMSDWz qT4KpADbk1J1dfXxPe5oNU6WQiCLPdbZJ1e+z8bRvhOklJ+EKHlMier45Snnc2rBODWz T+Eg== 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:in-reply-to :references:subject:cc:to:mime-version:user-agent:from:date :message-id; bh=o+jvK2piixmGZ5IebFMQca81FAAm9ajI80Q/SczVycU=; b=SoAnN/1JoHr39XTTIHVgrD0ZXoH8CMVt2MRqTzBXThuaaV6ETrIeA4pCuzt3uesvOo 6o3bPnU7JhQJ67L5hqFhReltU4YSRUMh6ZJnW5eHcX/MVim4ta5x2QW+G3xdRK10tbIY Vb7X4E6MqILHKhYTzpwJdZKRA6cKs9IKfkJi7DybL458qhpk2/vf4Q+96HFFYGBLZ3AE zSKppkKN8TDBHysu1p5sx2hswy7wMPfLPmt6b4MgbOCVlwfHygDsY/YygspONLtQAgGp XSIcVEBcX46qoInEMmi4gV1Vv/yxsjNa3Xkc6Ww3ts25PPEe6gbkgIxn98EFj6l9Jw5p kapA== ARC-Authentication-Results: i=1; mx.google.com; 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 b7-v6si20812073pfj.245.2018.09.11.02.19.48; Tue, 11 Sep 2018 02:20:09 -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; 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 S1726912AbeIKOSB (ORCPT + 99 others); Tue, 11 Sep 2018 10:18:01 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:11684 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726564AbeIKOSB (ORCPT ); Tue, 11 Sep 2018 10:18:01 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id CF70AC7377410; Tue, 11 Sep 2018 17:19:30 +0800 (CST) Received: from [127.0.0.1] (10.177.29.68) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.399.0; Tue, 11 Sep 2018 17:19:28 +0800 Message-ID: <5B97889F.3020303@huawei.com> Date: Tue, 11 Sep 2018 17:19:27 +0800 From: zhong jiang User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: Sergei Shtylyov CC: , , , , , Subject: Re: [PATCH] net: ipv4: Use BUG_ON directly instead of a if condition followed by BUG References: <1536590282-23899-1-git-send-email-zhongjiang@huawei.com> <5B9783ED.4080908@huawei.com> In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.29.68] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >>>> --- >>>> 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 > > >