From nobody Wed May 8 01:05:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=linux.alibaba.com ARC-Seal: i=1; a=rsa-sha256; t=1609310975; cv=none; d=zohomail.com; s=zohoarc; b=Ar9EFUBkiXSL/FIIocbPTo3JfXa5eoc1MTvU6pw8PTv99g+HT2UBKV5YOzmfFICLrIC/tLKi3wLrGluAsiY7ciE325tYXQS9eCbFKanLkWEfA00z3Yw2ptIb0Mflhdxir4Isf77fUVXvcbt0MGTihmBanNA6oaSQCOCCW3qoUvo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609310975; h=Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:Message-ID:Sender:Subject:To; bh=rgJ2efWcZ83ZWSWoXP2E+n6qUBqVSnGNlnFxUQDREjc=; b=aNHdkSzlkCrOizyalRIJXwBOjXbTAdE4MD3/EwCadN7ctsU2yYN1awxKn/kdmAK8YLo05jUTO/yYQVWEyJ1fEj25Gc8+qKU9AtlmEF1LsGT+N/KRpH0WKU/0rwYTpWdG3YzaZjddNUnCBsQk3voQ2wei8RX10yS3m3cJa+IqBfc= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1609310975461741.0175999334343; Tue, 29 Dec 2020 22:49:35 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.60081.105372 (Exim 4.92) (envelope-from ) id 1kuVIP-0003pn-3g; Wed, 30 Dec 2020 06:49:21 +0000 Received: by outflank-mailman (output) from mailman id 60081.105372; Wed, 30 Dec 2020 06:49:21 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kuVIP-0003pg-0Q; Wed, 30 Dec 2020 06:49:21 +0000 Received: by outflank-mailman (input) for mailman id 60081; Wed, 30 Dec 2020 06:38:23 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kuV7n-0002pP-P1 for xen-devel@lists.xenproject.org; Wed, 30 Dec 2020 06:38:23 +0000 Received: from out30-130.freemail.mail.aliyun.com (unknown [115.124.30.130]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id cce28589-9e69-4d2f-af03-5260576862af; Wed, 30 Dec 2020 06:38:21 +0000 (UTC) Received: from j63c13417.sqa.eu95.tbsite.net(mailfrom:abaci-bugfix@linux.alibaba.com fp:SMTPD_---0UKCfVeh_1609310288) by smtp.aliyun-inc.com(127.0.0.1); Wed, 30 Dec 2020 14:38:15 +0800 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: cce28589-9e69-4d2f-af03-5260576862af X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R971e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04394;MF=abaci-bugfix@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0UKCfVeh_1609310288; From: YANG LI To: boris.ostrovsky@oracle.com Cc: jgross@suse.com, sstabellini@kernel.org, xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, YANG LI Subject: [PATCH] xen: fix: use WARN_ON instead of if condition followed by BUG. Date: Wed, 30 Dec 2020 14:38:06 +0800 Message-Id: <1609310286-77985-1-git-send-email-abaci-bugfix@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Use WARN_ON instead of if condition followed by BUG in gnttab_batch_map() and gnttab_batch_copy(). This issue was detected with the help of coccicheck. Signed-off-by: YANG LI Reported-by: Abaci --- drivers/xen/grant-table.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c index 3729bea..db1770c 100644 --- a/drivers/xen/grant-table.c +++ b/drivers/xen/grant-table.c @@ -1080,8 +1080,8 @@ void gnttab_batch_map(struct gnttab_map_grant_ref *ba= tch, unsigned count) { struct gnttab_map_grant_ref *op; =20 - if (HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, batch, count)) - BUG(); + WARN_ON(HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, batch, count)); + for (op =3D batch; op < batch + count; op++) if (op->status =3D=3D GNTST_eagain) gnttab_retry_eagain_gop(GNTTABOP_map_grant_ref, op, @@ -1093,8 +1093,8 @@ void gnttab_batch_copy(struct gnttab_copy *batch, uns= igned count) { struct gnttab_copy *op; =20 - if (HYPERVISOR_grant_table_op(GNTTABOP_copy, batch, count)) - BUG(); + WARN_ON(HYPERVISOR_grant_table_op(GNTTABOP_copy, batch, count)); + for (op =3D batch; op < batch + count; op++) if (op->status =3D=3D GNTST_eagain) gnttab_retry_eagain_gop(GNTTABOP_copy, op, --=20 1.8.3.1