summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-05-31 18:41:09 +0000
committerphk <phk@FreeBSD.org>2003-05-31 18:41:09 +0000
commit9cf498d30d9770953c1035b5136fc55ab0540129 (patch)
treed6f639e72db334d9e0955ebdcbe4f74749876374
parent3fb7f13baa61906dde9cb484c9da5bbff6a02d42 (diff)
downloadFreeBSD-src-9cf498d30d9770953c1035b5136fc55ab0540129.zip
FreeBSD-src-9cf498d30d9770953c1035b5136fc55ab0540129.tar.gz
Fix off-by-one error in drive number check.
Don't return(foo(...)) in function returning void. Found by: FlexeLint
-rw-r--r--sys/dev/ciss/ciss.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/ciss/ciss.c b/sys/dev/ciss/ciss.c
index 6009b44..9608a15 100644
--- a/sys/dev/ciss/ciss.c
+++ b/sys/dev/ciss/ciss.c
@@ -973,7 +973,7 @@ ciss_init_logical(struct ciss_softc *sc)
/* sanity-check reply */
ndrives = (ntohl(cll->list_size) / sizeof(union ciss_device_address));
- if ((ndrives < 0) || (ndrives > CISS_MAX_LOGICAL)) {
+ if ((ndrives < 0) || (ndrives >= CISS_MAX_LOGICAL)) {
ciss_printf(sc, "adapter claims to report absurd number of logical drives (%d > %d)\n",
ndrives, CISS_MAX_LOGICAL);
return(ENXIO);
@@ -2139,7 +2139,7 @@ ciss_cam_rescan_target(struct ciss_softc *sc, int target)
static void
ciss_cam_rescan_all(struct ciss_softc *sc)
{
- return(ciss_cam_rescan_target(sc, 0));
+ ciss_cam_rescan_target(sc, 0);
}
static void
@@ -2271,7 +2271,7 @@ ciss_cam_action_io(struct cam_sim *sim, struct ccb_scsiio *csio)
/* check for I/O attempt to nonexistent device */
if ((bus != 0) ||
- (target > CISS_MAX_LOGICAL) ||
+ (target >= CISS_MAX_LOGICAL) ||
(sc->ciss_logical[target].cl_status == CISS_LD_NONEXISTENT)) {
debug(3, " device does not exist");
csio->ccb_h.status = CAM_REQ_CMP_ERR;
OpenPOWER on IntegriCloud