Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp76836pxf; Tue, 16 Mar 2021 23:00:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqPI7stH1KvLorRmSIiOLDxJwuGzR4SAedfq6GyQZTRFL4h2Y/t47jWLLzh1Wqr97uiV41 X-Received: by 2002:a17:906:7102:: with SMTP id x2mr33889345ejj.355.1615960833036; Tue, 16 Mar 2021 23:00:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615960833; cv=none; d=google.com; s=arc-20160816; b=cTxngOSwx9FGc/fIVztylXdUqHxl4gBS5PU4GByXRDWBhkaRa+7QMimee4Et96OTim E8xLhaLV93GnwhDpzl2jK5odvVKV/nXdgK+gVeyl40lxsAgb0Ym9NIGnanBF4oNNu2sc aOyFcBzG11aNY3PLTil/6tz9nslOjpOrno5NdbxeUE1JxasbuWcwKauNdfRKD7njbdt4 x87OA6ECD88Rx8UKfYGAhfi6WKDxgTL0tCxTiS7jvs38OwtKtDwi2rYGNBrt0Er5IFa6 q0vn8uHRescdNyMVvYTpNhgPqdd0CBH9Mrpkiz0CPe4r8sEMki8HqVUT7ZfKrxux0/GI HXDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=X5QhbmcOUbLWetW6rv2EYCMgf4P13N9jlAqV6d6Ik0o=; b=jRTzPiQ8cVtjX8grUxHIEv42NEUXK1+zc9I72lMXTlJxDraKgcTlpEtHARJ0a/wLSq P2jd4Gg/pPn5nSMwWsHyxGF9HEu7ZP+OVdXtydvKyy5AYSKLn6b9Lh+QYP80LgjuQRFN jn/o633sk9rjIYjk9SMQFpmetWAhj02dxIdLR7MCUtEl+rDaLBnrU1916Fqqk0lZp1Dr Y8XblN+dPYVzg1WbqTMc1TFrGOt8T0RGetOPkaHlSjzvqp5XBInScGGRDIROEO5F4aF9 oWnX0GT21Dvlyicuj+pz+nI4WRQcaDGR/0In+7qg149UqD3jetTR0bWJ5bqqlk86lpm4 oBbw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bc17si15340642edb.2.2021.03.16.23.00.10; Tue, 16 Mar 2021 23:00:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229996AbhCQF54 (ORCPT + 99 others); Wed, 17 Mar 2021 01:57:56 -0400 Received: from out30-44.freemail.mail.aliyun.com ([115.124.30.44]:45070 "EHLO out30-44.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229492AbhCQF51 (ORCPT ); Wed, 17 Mar 2021 01:57:27 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R221e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=alimailimapcm10staff010182156082;MF=jiapeng.chong@linux.alibaba.com;NM=1;PH=DS;RN=18;SR=0;TI=SMTPD_---0USDZNaf_1615960639; Received: from j63c13417.sqa.eu95.tbsite.net(mailfrom:jiapeng.chong@linux.alibaba.com fp:SMTPD_---0USDZNaf_1615960639) by smtp.aliyun-inc.com(127.0.0.1); Wed, 17 Mar 2021 13:57:22 +0800 From: Jiapeng Chong To: mst@redhat.com Cc: jasowang@redhat.com, davem@davemloft.net, kuba@kernel.org, ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com, andrii@kernel.org, kafai@fb.com, songliubraving@fb.com, yhs@fb.com, kpsingh@kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Jiapeng Chong Subject: [PATCH] virtio_net: replace if (cond) BUG() with BUG_ON() Date: Wed, 17 Mar 2021 13:57:15 +0800 Message-Id: <1615960635-29735-1-git-send-email-jiapeng.chong@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix the following coccicheck warnings: ./drivers/net/virtio_net.c:1551:2-5: WARNING: Use BUG_ON instead of if condition followed by BUG. Reported-by: Abaci Robot Signed-off-by: Jiapeng Chong --- drivers/net/virtio_net.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 82e520d..093530b 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -1545,10 +1545,8 @@ static int xmit_skb(struct send_queue *sq, struct sk_buff *skb) else hdr = skb_vnet_hdr(skb); - if (virtio_net_hdr_from_skb(skb, &hdr->hdr, - virtio_is_little_endian(vi->vdev), false, - 0)) - BUG(); + BUG_ON(virtio_net_hdr_from_skb(skb, &hdr->hdr, virtio_is_little_endian(vi->vdev), + false, 0)); if (vi->mergeable_rx_bufs) hdr->num_buffers = 0; -- 1.8.3.1