From 0794d132914a8e8798ec55bc807dca3868fcf098 Mon Sep 17 00:00:00 2001 From: robert Date: Sun, 27 Jul 2003 00:13:49 +0000 Subject: Changed the type of the variable `qidx' from u_int8_t to int, mainly to quiet a warning emitted by GCC 3.3 about comparing a variable to a value which is larger than the former can hold. The value was checked to make sure the `np->squeue' array is not accessed behind its boundary. This worked due to possibly accidental truncation when (np->squeueput + 1) was larger than or equal to MAX_START (256) when it was assigned to `qidx'. `qidx' is used to hold the next position in the start queue for an insertion. The new type was chosen because some other code in the function ncr_freeze_devq() also uses plain integers to hold those indices. Wrapped the line after the closing parenthesis of an `if' condition. --- sys/pci/ncr.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sys/pci/ncr.c') diff --git a/sys/pci/ncr.c b/sys/pci/ncr.c index ca121f2..a1d58a0 100644 --- a/sys/pci/ncr.c +++ b/sys/pci/ncr.c @@ -3880,7 +3880,7 @@ ncr_action (struct cam_sim *sim, union ccb *ccb) int segments; u_int8_t nego; u_int8_t idmsg; - u_int8_t qidx; + int qidx; tp = &np->target[ccb->ccb_h.target_id]; csio = &ccb->csio; @@ -4154,7 +4154,8 @@ ncr_action (struct cam_sim *sim, union ccb *ccb) */ qidx = np->squeueput + 1; - if (qidx >= MAX_START) qidx=0; + if (qidx >= MAX_START) + qidx = 0; np->squeue [qidx ] = NCB_SCRIPT_PHYS (np, idle); np->squeue [np->squeueput] = CCB_PHYS (cp, phys); np->squeueput = qidx; -- cgit v1.1