Fix off by one read error.

This commit is contained in:
msaitoh 2012-12-11 09:17:31 +00:00
parent 202434cbda
commit 5d8b710d44
3 changed files with 6 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ubsa_common.c,v 1.8 2012/02/24 06:48:25 mrg Exp $ */
/* $NetBSD: ubsa_common.c,v 1.9 2012/12/11 09:17:31 msaitoh Exp $ */
/*-
* Copyright (c) 2002, Alexander Kabaev <kan.FreeBSD.org>.
* All rights reserved.
@ -54,7 +54,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ubsa_common.c,v 1.8 2012/02/24 06:48:25 mrg Exp $");
__KERNEL_RCSID(0, "$NetBSD: ubsa_common.c,v 1.9 2012/12/11 09:17:31 msaitoh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -105,7 +105,7 @@ ubsa_request(struct ubsa_softc *sc, int portno, u_int8_t request, u_int16_t valu
else
req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
if (portno > UBSA_MAXCONN) {
if (portno >= UBSA_MAXCONN) {
printf("%s: ubsa_request: invalid port(%d)#\n",
device_xname(sc->sc_dev), portno);
return USBD_INVAL;

View File

@ -14,7 +14,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $Id: ah_eeprom_v14.c,v 1.5 2011/03/07 11:25:42 cegger Exp $
* $Id: ah_eeprom_v14.c,v 1.6 2012/12/11 09:22:16 msaitoh Exp $
*/
#include "opt_ah.h"
@ -255,7 +255,7 @@ v14EepromReadCTLInfo(struct ath_hal *ah, HAL_EEPROM_v14 *ee)
HALASSERT(AR5416_NUM_CTLS <= sizeof(ee->ee_rdEdgesPower)/NUM_EDGES);
for (i = 0; ee->ee_base.ctlIndex[i] != 0 && i < AR5416_NUM_CTLS; i++) {
for (i = 0; i < AR5416_NUM_CTLS && ee->ee_base.ctlIndex[i] != 0; i++) {
for (j = 0; j < NUM_EDGES; j ++) {
/* XXX Confirm this is the right thing to do when an invalid channel is stored */
if (ee->ee_base.ctlData[i].ctlEdges[CTL_CHAIN][j].bChannel == AR5416_BCHAN_UNUSED) {

View File

@ -238,7 +238,7 @@ v4kEepromReadCTLInfo(struct ath_hal *ah, HAL_EEPROM_v4k *ee)
HALASSERT(AR5416_4K_NUM_CTLS <= sizeof(ee->ee_rdEdgesPower)/NUM_EDGES);
for (i = 0; ee->ee_base.ctlIndex[i] != 0 && i < AR5416_4K_NUM_CTLS; i++) {
for (i = 0; i < AR5416_4K_NUM_CTLS && ee->ee_base.ctlIndex[i] != 0; i++) {
for (j = 0; j < NUM_EDGES; j ++) {
/* XXX Confirm this is the right thing to do when an invalid channel is stored */
if (ee->ee_base.ctlData[i].ctlEdges[CTL_CHAIN][j].bChannel == AR5416_BCHAN_UNUSED) {