Date: Wed, 4 Apr 2012 21:19:19 +0000 (UTC) From: Marius Strobl <marius@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r233889 - in stable/9/sys: i386/conf sparc64/sparc64 Message-ID: <201204042119.q34LJJm0025493@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: marius Date: Wed Apr 4 21:19:19 2012 New Revision: 233889 URL: http://svn.freebsd.org/changeset/base/233889 Log: MFC: r233747, r233748 - Fix panic on kernel traps having a mapping in trap_sig b0rked in r206086. Reported by: David E. Cross - Remove checks that are redundant due to tf_type being unsigned. Modified: stable/9/sys/sparc64/sparc64/trap.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/amd64/include/xen/ (props changed) stable/9/sys/boot/ (props changed) stable/9/sys/boot/i386/efi/ (props changed) stable/9/sys/boot/ia64/efi/ (props changed) stable/9/sys/boot/ia64/ski/ (props changed) stable/9/sys/boot/powerpc/boot1.chrp/ (props changed) stable/9/sys/boot/powerpc/ofw/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) stable/9/sys/conf/ (props changed) stable/9/sys/contrib/dev/acpica/ (props changed) stable/9/sys/contrib/octeon-sdk/ (props changed) stable/9/sys/contrib/pf/ (props changed) stable/9/sys/contrib/x86emu/ (props changed) stable/9/sys/fs/ (props changed) stable/9/sys/fs/ntfs/ (props changed) stable/9/sys/i386/conf/XENHVM (props changed) Modified: stable/9/sys/sparc64/sparc64/trap.c ============================================================================== --- stable/9/sys/sparc64/sparc64/trap.c Wed Apr 4 21:09:02 2012 (r233888) +++ stable/9/sys/sparc64/sparc64/trap.c Wed Apr 4 21:19:19 2012 (r233889) @@ -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 > 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 > 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?201204042119.q34LJJm0025493>