Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 31 Mar 2012 13:56:24 +0000 (UTC)
From:      Marius Strobl <marius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r233747 - head/sys/sparc64/sparc64
Message-ID:  <201203311356.q2VDuOYx004848@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marius
Date: Sat Mar 31 13:56:24 2012
New Revision: 233747
URL: http://svn.freebsd.org/changeset/base/233747

Log:
  Fix panic on kernel traps having a mapping in trap_sig b0rked in r206086.
  Repored by:	David E. Cross
  
  MFC after:	3 days

Modified:
  head/sys/sparc64/sparc64/trap.c

Modified: head/sys/sparc64/sparc64/trap.c
==============================================================================
--- head/sys/sparc64/sparc64/trap.c	Sat Mar 31 11:23:09 2012	(r233746)
+++ head/sys/sparc64/sparc64/trap.c	Sat Mar 31 13:56:24 2012	(r233747)
@@ -215,6 +215,9 @@ static const int trap_sig[] = {
 	-1,			/* kernel stack fault */
 };
 
+CTASSERT(sizeof(trap_msg) / sizeof(*trap_msg) == T_MAX);
+CTASSERT(sizeof(trap_sig) / sizeof(*trap_sig) == T_MAX);
+
 CTASSERT(sizeof(struct trapframe) == 256);
 
 int debugger_on_signal = 0;
@@ -298,7 +301,7 @@ trap(struct trapframe *tf)
 			sig = trap_cecc();
 			break;
 		default:
-			if (tf->tf_type < 0 || tf->tf_type >= T_MAX)
+			if (tf->tf_type < 0 || tf->tf_type > T_MAX)
 				panic("trap: bad trap type %#lx (user)",
 				    tf->tf_type);
 			else if (trap_sig[tf->tf_type] == -1)
@@ -402,12 +405,10 @@ trap(struct trapframe *tf)
 
 		if (error != 0) {
 			tf->tf_type &= ~T_KERNEL;
-			if (tf->tf_type < 0 || tf->tf_type >= T_MAX)
+			if (tf->tf_type < 0 || tf->tf_type > T_MAX)
 				panic("trap: bad trap type %#lx (kernel)",
 				    tf->tf_type);
-			else if (trap_sig[tf->tf_type] == -1)
-				panic("trap: %s (kernel)",
-				    trap_msg[tf->tf_type]);
+			panic("trap: %s (kernel)", trap_msg[tf->tf_type]);
 		}
 	}
 	CTR1(KTR_TRAP, "trap: td=%p return", td);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203311356.q2VDuOYx004848>