Author: rwatson Date: Thu Feb 25 09:51:14 2010 New Revision: 204303 URL: http://svn.freebsd.org/changeset/base/204303
Log: Fix edge cases in several KASSERTs: use <= rather than < when testing that counters have not gone about MAXCPU or NETISR_MAXPROT. These problems caused panics on UP kernels with INVARIANTS when using sysctl -a, but would also have caused problems for 32-core boxes or if the netisr protocol vector was fully populated. Reported by: nwhitehorn, Neel Natu <neeln...@gmail.com> MFC after: 4 days Modified: head/sys/net/netisr.c Modified: head/sys/net/netisr.c ============================================================================== --- head/sys/net/netisr.c Thu Feb 25 06:53:46 2010 (r204302) +++ head/sys/net/netisr.c Thu Feb 25 09:51:14 2010 (r204303) @@ -1167,7 +1167,7 @@ sysctl_netisr_proto(SYSCTL_HANDLER_ARGS) counter++; } NETISR_RUNLOCK(&tracker); - KASSERT(counter < NETISR_MAXPROT, + KASSERT(counter <= NETISR_MAXPROT, ("sysctl_netisr_proto: counter too big (%d)", counter)); error = SYSCTL_OUT(req, snp_array, sizeof(*snp_array) * counter); free(snp_array, M_TEMP); @@ -1220,7 +1220,7 @@ sysctl_netisr_workstream(SYSCTL_HANDLER_ counter++; } NETISR_RUNLOCK(&tracker); - KASSERT(counter < MAXCPU, + KASSERT(counter <= MAXCPU, ("sysctl_netisr_workstream: counter too big (%d)", counter)); error = SYSCTL_OUT(req, snws_array, sizeof(*snws_array) * counter); free(snws_array, M_TEMP); @@ -1281,7 +1281,7 @@ sysctl_netisr_work(SYSCTL_HANDLER_ARGS) } NWS_UNLOCK(nwsp); } - KASSERT(counter < MAXCPU * NETISR_MAXPROT, + KASSERT(counter <= MAXCPU * NETISR_MAXPROT, ("sysctl_netisr_work: counter too big (%d)", counter)); NETISR_RUNLOCK(&tracker); error = SYSCTL_OUT(req, snw_array, sizeof(*snw_array) * counter); _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"