lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 24 Aug 2021 23:22:22 -0700
From:   CGEL <cgel.zte@...il.com>
To:     Boris Ostrovsky <boris.ostrovsky@...cle.com>
Cc:     Juergen Gross <jgross@...e.com>,
        Stefano Stabellini <sstabellini@...nel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Wei Liu <wei.liu@...nel.org>, Jan Beulich <jbeulich@...e.com>,
        xen-devel@...ts.xenproject.org, linux-kernel@...r.kernel.org,
        Jing Yangyang <jing.yangyang@....com.cn>,
        Zeal Robot <zealci@....com.cn>
Subject: [PATCH linux-next] drivers/xen/events/events_base.c: fix bugon.cocci warnings

From: Jing Yangyang <jing.yangyang@....com.cn>

Use BUG_ON instead of a if condition followed by BUG.

Generated by: scripts/coccinelle/misc/bugon.cocci

Reported-by: Zeal Robot <zealci@....com.cn>
Signed-off-by: Jing Yangyang <jing.yangyang@....com.cn>
---
 drivers/xen/events/events_base.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c
index a78704a..dd44019 100644
--- a/drivers/xen/events/events_base.c
+++ b/drivers/xen/events/events_base.c
@@ -818,8 +818,7 @@ static void xen_evtchn_close(evtchn_port_t port)
 	struct evtchn_close close;
 
 	close.port = port;
-	if (HYPERVISOR_event_channel_op(EVTCHNOP_close, &close) != 0)
-		BUG();
+	BUG_ON(HYPERVISOR_event_channel_op(EVTCHNOP_close, &close) != 0);
 }
 
 /* Not called for lateeoi events. */
@@ -1270,9 +1269,8 @@ static int bind_ipi_to_irq(unsigned int ipi, unsigned int cpu)
 					      handle_percpu_irq, "ipi");
 
 		bind_ipi.vcpu = xen_vcpu_nr(cpu);
-		if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_ipi,
-						&bind_ipi) != 0)
-			BUG();
+		BUG_ON(HYPERVISOR_event_channel_op(EVTCHNOP_bind_ipi,
+						&bind_ipi) != 0);
 		evtchn = bind_ipi.port;
 
 		ret = xen_irq_info_ipi_setup(cpu, irq, evtchn, ipi);
@@ -1983,9 +1981,8 @@ static void restore_cpu_virqs(unsigned int cpu)
 		/* Get a new binding from Xen. */
 		bind_virq.virq = virq;
 		bind_virq.vcpu = xen_vcpu_nr(cpu);
-		if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_virq,
-						&bind_virq) != 0)
-			BUG();
+		BUG_ON(HYPERVISOR_event_channel_op(EVTCHNOP_bind_virq,
+						&bind_virq) != 0);
 		evtchn = bind_virq.port;
 
 		/* Record the new mapping. */
@@ -2009,9 +2006,8 @@ static void restore_cpu_ipis(unsigned int cpu)
 
 		/* Get a new binding from Xen. */
 		bind_ipi.vcpu = xen_vcpu_nr(cpu);
-		if (HYPERVISOR_event_channel_op(EVTCHNOP_bind_ipi,
-						&bind_ipi) != 0)
-			BUG();
+		BUG_ON(HYPERVISOR_event_channel_op(EVTCHNOP_bind_ipi,
+						&bind_ipi) != 0);
 		evtchn = bind_ipi.port;
 
 		/* Record the new mapping. */
@@ -2063,8 +2059,7 @@ void xen_poll_irq_timeout(int irq, u64 timeout)
 		poll.timeout = timeout;
 		set_xen_guest_handle(poll.ports, &evtchn);
 
-		if (HYPERVISOR_sched_op(SCHEDOP_poll, &poll) != 0)
-			BUG();
+		BUG_ON(HYPERVISOR_sched_op(SCHEDOP_poll, &poll) != 0);
 	}
 }
 EXPORT_SYMBOL(xen_poll_irq_timeout);
-- 
1.8.3.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ