From 31278c14d6e1497b4cd36ffcdf1e92d03d24a8ed Mon Sep 17 00:00:00 2001 From: Constantine Sapuntzakis Date: Wed, 4 Jul 2001 05:12:59 +0000 Subject: Fix off-by-one error in unit checking --- sys/arch/vax/mscp/mscp_disk.c | 6 +++--- sys/arch/vax/mscp/mscp_tape.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'sys/arch/vax/mscp') diff --git a/sys/arch/vax/mscp/mscp_disk.c b/sys/arch/vax/mscp/mscp_disk.c index 6c61963e064..ae0b4eb2a44 100644 --- a/sys/arch/vax/mscp/mscp_disk.c +++ b/sys/arch/vax/mscp/mscp_disk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mscp_disk.c,v 1.7 2000/04/27 03:14:46 bjc Exp $ */ +/* $OpenBSD: mscp_disk.c,v 1.8 2001/07/04 05:12:57 csapuntz Exp $ */ /* $NetBSD: mscp_disk.c,v 1.21 1999/06/06 19:16:18 ragge Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. @@ -317,7 +317,7 @@ rastrategy(bp) * Make sure this is a reasonable drive to use. */ unit = DISKUNIT(bp->b_dev); - if (unit > ra_cd.cd_ndevs || (ra = ra_cd.cd_devs[unit]) == NULL) { + if (unit >= ra_cd.cd_ndevs || (ra = ra_cd.cd_devs[unit]) == NULL) { bp->b_error = ENXIO; bp->b_flags |= B_ERROR; goto done; @@ -685,7 +685,7 @@ rxstrategy(bp) * Make sure this is a reasonable drive to use. */ unit = DISKUNIT(bp->b_dev); - if (unit > rx_cd.cd_ndevs || (rx = rx_cd.cd_devs[unit]) == NULL) { + if (unit >= rx_cd.cd_ndevs || (rx = rx_cd.cd_devs[unit]) == NULL) { bp->b_error = ENXIO; bp->b_flags |= B_ERROR; goto done; diff --git a/sys/arch/vax/mscp/mscp_tape.c b/sys/arch/vax/mscp/mscp_tape.c index 49f53e1df12..d08d21495ff 100644 --- a/sys/arch/vax/mscp/mscp_tape.c +++ b/sys/arch/vax/mscp/mscp_tape.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mscp_tape.c,v 1.4 2000/04/27 03:14:46 bjc Exp $ */ +/* $OpenBSD: mscp_tape.c,v 1.5 2001/07/04 05:12:58 csapuntz Exp $ */ /* $NetBSD: mscp_tape.c,v 1.14 1999/06/06 19:16:18 ragge Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. @@ -260,7 +260,7 @@ mtstrategy(bp) * Make sure this is a reasonable drive to use. */ unit = mtunit(bp->b_dev); - if (unit > mt_cd.cd_ndevs || (mt = mt_cd.cd_devs[unit]) == NULL) { + if (unit >= mt_cd.cd_ndevs || (mt = mt_cd.cd_devs[unit]) == NULL) { bp->b_error = ENXIO; goto bad; } -- cgit v1.2.3