Module Name: src Committed By: christos Date: Tue Feb 24 12:57:58 UTC 2015
Modified Files: src/sys/dev/pci: if_iwm.c Log Message: Work around Coverity CIDs 127102{0,1}: Confused by the comparison nrates > __arraycount(lq->rs_table), coverity erroneously binds nrates to the range [0..16), whereas it is really bound to [0..15) by ni->ni_rates.rs_nrates (IEEE80211_RATE_MAXSIZE). We add an explicit comparison to unconfuse it that will always succeed. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/dev/pci/if_iwm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/pci/if_iwm.c diff -u src/sys/dev/pci/if_iwm.c:1.13 src/sys/dev/pci/if_iwm.c:1.14 --- src/sys/dev/pci/if_iwm.c:1.13 Mon Feb 23 21:26:15 2015 +++ src/sys/dev/pci/if_iwm.c Tue Feb 24 07:57:58 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: if_iwm.c,v 1.13 2015/02/24 02:26:15 nonaka Exp $ */ +/* $NetBSD: if_iwm.c,v 1.14 2015/02/24 12:57:58 christos Exp $ */ /* OpenBSD: if_iwm.c,v 1.18 2015/02/11 01:12:42 brad Exp */ /* @@ -105,7 +105,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.13 2015/02/24 02:26:15 nonaka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.14 2015/02/24 12:57:58 christos Exp $"); #include <sys/param.h> #include <sys/conf.h> @@ -5329,7 +5329,8 @@ iwm_setrates(struct iwm_node *in) int i, ridx, tab = 0; int txant = 0; - if (nrates > __arraycount(lq->rs_table)) { + if (nrates > __arraycount(lq->rs_table) || + nrates > IEEE80211_RATE_MAXSIZE) { DPRINTF(("%s: node supports %d rates, driver handles only " "%zu\n", DEVNAME(sc), nrates, __arraycount(lq->rs_table))); return;