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]
Message-Id: <20170630170128.26839-1-dave@stgolabs.net>
Date:   Fri, 30 Jun 2017 10:01:28 -0700
From:   Davidlohr Bueso <dave@...olabs.net>
To:     akpm@...ux-foundation.org
Cc:     cpw@....com, robinmholt@...il.com, dave@...olabs.net,
        linux-kernel@...r.kernel.org, Davidlohr Bueso <dbueso@...e.de>
Subject: [PATCH] sgi-xp: convert BUG_ONs to WARN_ONs... sheesh

While going through the driver wake code, I found the
abuse of BUG_ON to be quite disturbing.

Drivers (particularly misc!!!) should not be bringing
the kernel to a halt... *sheesh*. Blindly convert
them to warnings and let the sgi-xp self-destruct.
While WARNs are still abusive, I have no plans on
going further than this to cleanup the mess.

Signed-off-by: Davidlohr Bueso <dbueso@...e.de>
---
 drivers/misc/sgi-xp/xp_sn2.c        |  4 ++--
 drivers/misc/sgi-xp/xp_uv.c         |  8 ++++----
 drivers/misc/sgi-xp/xpc_main.c      |  4 ++--
 drivers/misc/sgi-xp/xpc_partition.c |  2 +-
 drivers/misc/sgi-xp/xpc_uv.c        | 14 +++++++-------
 5 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/misc/sgi-xp/xp_sn2.c b/drivers/misc/sgi-xp/xp_sn2.c
index d8e463f87241..c70ee81347e2 100644
--- a/drivers/misc/sgi-xp/xp_sn2.c
+++ b/drivers/misc/sgi-xp/xp_sn2.c
@@ -164,7 +164,7 @@ xp_restrict_memprotect_sn2(unsigned long phys_addr, unsigned long size)
 enum xp_retval
 xp_init_sn2(void)
 {
-	BUG_ON(!is_shub());
+	WARN_ON(!is_shub());
 
 	xp_max_npartitions = XP_MAX_NPARTITIONS_SN2;
 	xp_partition_id = sn_partition_id;
@@ -183,7 +183,7 @@ xp_init_sn2(void)
 void
 xp_exit_sn2(void)
 {
-	BUG_ON(!is_shub());
+	WARN_ON(!is_shub());
 
 	xp_unregister_nofault_code_sn2();
 }
diff --git a/drivers/misc/sgi-xp/xp_uv.c b/drivers/misc/sgi-xp/xp_uv.c
index a0d093274dc0..819d2fcef3b5 100644
--- a/drivers/misc/sgi-xp/xp_uv.c
+++ b/drivers/misc/sgi-xp/xp_uv.c
@@ -48,8 +48,8 @@ xp_remote_mmr_read(unsigned long dst_gpa, const unsigned long src_gpa,
 	int ret;
 	unsigned long *dst_va = __va(uv_gpa_to_soc_phys_ram(dst_gpa));
 
-	BUG_ON(!uv_gpa_in_mmr_space(src_gpa));
-	BUG_ON(len != 8);
+	WARN_ON(!uv_gpa_in_mmr_space(src_gpa));
+	WARN_ON(len != 8);
 
 	ret = gru_read_gpa(dst_va, src_gpa);
 	if (ret == 0)
@@ -148,7 +148,7 @@ xp_restrict_memprotect_uv(unsigned long phys_addr, unsigned long size)
 enum xp_retval
 xp_init_uv(void)
 {
-	BUG_ON(!is_uv());
+	WARN_ON(!is_uv());
 
 	xp_max_npartitions = XP_MAX_NPARTITIONS_UV;
 	xp_partition_id = sn_partition_id;
@@ -167,5 +167,5 @@ xp_init_uv(void)
 void
 xp_exit_uv(void)
 {
-	BUG_ON(!is_uv());
+	WARN_ON(!is_uv());
 }
diff --git a/drivers/misc/sgi-xp/xpc_main.c b/drivers/misc/sgi-xp/xpc_main.c
index 7f327121e6d7..5f23b2d8e6a0 100644
--- a/drivers/misc/sgi-xp/xpc_main.c
+++ b/drivers/misc/sgi-xp/xpc_main.c
@@ -796,8 +796,8 @@ xpc_create_kthreads(struct xpc_channel *ch, int needed,
 		if (ignore_disconnecting) {
 			if (!atomic_inc_not_zero(&ch->kthreads_assigned)) {
 				/* kthreads assigned had gone to zero */
-				BUG_ON(!(ch->flags &
-					 XPC_C_DISCONNECTINGCALLOUT_MADE));
+				WARN_ON(!(ch->flags &
+					  XPC_C_DISCONNECTINGCALLOUT_MADE));
 				break;
 			}
 
diff --git a/drivers/misc/sgi-xp/xpc_partition.c b/drivers/misc/sgi-xp/xpc_partition.c
index 6956f7e7d439..ff2419441e40 100644
--- a/drivers/misc/sgi-xp/xpc_partition.c
+++ b/drivers/misc/sgi-xp/xpc_partition.c
@@ -155,7 +155,7 @@ xpc_setup_rsvd_page(void)
 		/* SAL_versions < 3 had a SAL_partid defined as a u8 */
 		rp->SAL_partid &= 0xff;
 	}
-	BUG_ON(rp->SAL_partid != xp_partition_id);
+	WARN_ON(rp->SAL_partid != xp_partition_id);
 
 	if (rp->SAL_partid < 0 || rp->SAL_partid >= xp_max_npartitions) {
 		dev_err(xpc_part, "the reserved page's partid of %d is outside "
diff --git a/drivers/misc/sgi-xp/xpc_uv.c b/drivers/misc/sgi-xp/xpc_uv.c
index 340b44d9e8cf..23ff09c7c455 100644
--- a/drivers/misc/sgi-xp/xpc_uv.c
+++ b/drivers/misc/sgi-xp/xpc_uv.c
@@ -193,10 +193,10 @@ xpc_gru_mq_watchlist_free_uv(struct xpc_gru_mq_uv *mq)
 
 #if defined CONFIG_X86_64
 	ret = uv_bios_mq_watchlist_free(mmr_pnode, mq->watchlist_num);
-	BUG_ON(ret != BIOS_STATUS_SUCCESS);
+	WARN_ON(ret != BIOS_STATUS_SUCCESS);
 #elif defined CONFIG_IA64_GENERIC || defined CONFIG_IA64_SGI_UV
 	ret = sn_mq_watchlist_free(mmr_pnode, mq->watchlist_num);
-	BUG_ON(ret != SALRET_OK);
+	WARN_ON(ret != SALRET_OK);
 #else
 	#error not a supported configuration
 #endif
@@ -314,7 +314,7 @@ xpc_destroy_gru_mq_uv(struct xpc_gru_mq_uv *mq)
 	/* disallow other partitions to access GRU mq */
 	mq_size = 1UL << mq->order;
 	ret = xp_restrict_memprotect(xp_pa(mq->address), mq_size);
-	BUG_ON(ret != xpSuccess);
+	WARN_ON(ret != xpSuccess);
 
 	/* unregister irq handler and release mq irq/vector mapping */
 	free_irq(mq->irq, NULL);
@@ -383,7 +383,7 @@ xpc_process_activate_IRQ_rcvd_uv(void)
 			continue;
 
 		xpc_activate_IRQ_rcvd--;
-		BUG_ON(xpc_activate_IRQ_rcvd < 0);
+		WARN_ON(xpc_activate_IRQ_rcvd < 0);
 
 		act_state_req = part->sn.uv.act_state_req;
 		part->sn.uv.act_state_req = 0;
@@ -974,7 +974,7 @@ xpc_get_fifo_entry_uv(struct xpc_fifo_head_uv *head)
 			head->last = NULL;
 
 		head->n_entries--;
-		BUG_ON(head->n_entries < 0);
+		WARN_ON(head->n_entries < 0);
 
 		first->next = NULL;
 	}
@@ -1393,7 +1393,7 @@ xpc_handle_notify_mq_ack_uv(struct xpc_channel *ch,
 
 	msg_slot = &ch->sn.uv.send_msg_slots[entry];
 
-	BUG_ON(msg_slot->msg_slot_number != msg->hdr.msg_slot_number);
+	WARN_ON(msg_slot->msg_slot_number != msg->hdr.msg_slot_number);
 	msg_slot->msg_slot_number += ch->local_nentries;
 
 	if (msg_slot->func != NULL)
@@ -1451,7 +1451,7 @@ xpc_handle_notify_mq_msg_uv(struct xpc_partition *part,
 	msg_slot = ch_uv->recv_msg_slots +
 	    (msg->hdr.msg_slot_number % ch->remote_nentries) * ch->entry_size;
 
-	BUG_ON(msg_slot->hdr.size != 0);
+	WARN_ON(msg_slot->hdr.size != 0);
 
 	memcpy(msg_slot, msg, msg->hdr.size);
 
-- 
2.12.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ