diff options
author | rwatson <rwatson@FreeBSD.org> | 2010-02-25 09:51:14 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2010-02-25 09:51:14 +0000 |
commit | e0805e87a36c982b61c1342c733b8742760fb77f (patch) | |
tree | 81b6ec0cb422859b3d4b3906492cab969ae5bf88 | |
parent | 32836c9c22ac4fe6d415e5c361d594fd9b7457dd (diff) | |
download | FreeBSD-src-e0805e87a36c982b61c1342c733b8742760fb77f.zip FreeBSD-src-e0805e87a36c982b61c1342c733b8742760fb77f.tar.gz |
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 <neelnatu@gmail.com>
MFC after: 4 days
-rw-r--r-- | sys/net/netisr.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/net/netisr.c b/sys/net/netisr.c index d74682f..33b0180 100644 --- a/sys/net/netisr.c +++ b/sys/net/netisr.c @@ -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_ARGS) 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); |