From owner-svn-src-all@FreeBSD.ORG Wed Apr 4 21:19:28 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 48C7B1065674; Wed, 4 Apr 2012 21:19:28 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3375A8FC0A; Wed, 4 Apr 2012 21:19:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q34LJSLY025572; Wed, 4 Apr 2012 21:19:28 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q34LJSQC025570; Wed, 4 Apr 2012 21:19:28 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201204042119.q34LJSQC025570@svn.freebsd.org> From: Marius Strobl Date: Wed, 4 Apr 2012 21:19:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233891 - stable/7/sys/sparc64/sparc64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Apr 2012 21:19:28 -0000 Author: marius Date: Wed Apr 4 21:19:27 2012 New Revision: 233891 URL: http://svn.freebsd.org/changeset/base/233891 Log: MFC: r233747, r233748 - Fix panic on kernel traps having a mapping in trap_sig b0rked in r206086 (MFC'ed to stable/7 in r206197). Reported by: David E. Cross - Remove checks that are redundant due to tf_type being unsigned. Modified: stable/7/sys/sparc64/sparc64/trap.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/sparc64/sparc64/trap.c ============================================================================== --- stable/7/sys/sparc64/sparc64/trap.c Wed Apr 4 21:19:24 2012 (r233890) +++ stable/7/sys/sparc64/sparc64/trap.c Wed Apr 4 21:19:27 2012 (r233891) @@ -224,6 +224,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; @@ -307,7 +310,7 @@ trap(struct trapframe *tf) sig = trap_cecc(); break; default: - if (tf->tf_type < 0 || tf->tf_type >= T_MAX) + if (tf->tf_type > T_MAX) panic("trap: bad trap type %#lx (user)", tf->tf_type); else if (trap_sig[tf->tf_type] == -1) @@ -411,12 +414,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 > 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);