From: David S. Miller <davem@bnsf.davemloft.net>
Date: Mon, 29 Oct 2007 07:36:09 +0000 (-0700)
Subject: [SPARC64]: Fix build failure when CONFIG_BUG is disabled.
X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7e5766fa9431602ef0e56ceae900d0cce3a78b96;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git

[SPARC64]: Fix build failure when CONFIG_BUG is disabled.

When CONFIG_BUG is turned off, the standard trick of:

	switch (x) {
	case X:
	...
	case Y:
	...
	default:
		BUG();
	};

to mark impossible cases does not work because BUG() evalutes
to nothing and thus GCC just sees a fallthrough code path.

Add an explicit KERN_ERR log message and a do_exit() to trap
this case.

Signed-off-by: David S. Miller <davem@davemloft.net>
---

diff --git a/arch/sparc64/mm/tsb.c b/arch/sparc64/mm/tsb.c
index 7ff0a02f5813..a3e6e4b635b3 100644
--- a/arch/sparc64/mm/tsb.c
+++ b/arch/sparc64/mm/tsb.c
@@ -182,7 +182,9 @@ static void setup_tsb_params(struct mm_struct *mm, unsigned long tsb_idx, unsign
 		break;
 
 	default:
-		BUG();
+		printk(KERN_ERR "TSB[%s:%d]: Impossible TSB size %lu, killing process.\n",
+		       current->comm, current->pid, tsb_bytes);
+		do_exit(SIGSEGV);
 	};
 	tte |= pte_sz_bits(page_sz);