[SCSI] audit drivers for incorrect max_id use
authorHannes Reinecke <hare@suse.de>
Tue, 23 May 2006 08:29:28 +0000 (10:29 +0200)
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>
Sun, 28 May 2006 17:07:41 +0000 (13:07 -0400)
max_id now means the maximum number of ids on the bus, which means it
is one greater than the largest possible id number.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
drivers/scsi/53c700.c
drivers/scsi/53c7xx.c
drivers/scsi/aic7xxx/aic79xx_core.c
drivers/scsi/aic7xxx/aic7xxx_core.c
drivers/scsi/atp870u.c

index 6a0f9506ea00e7631ab60e0fee7f11d437c29309..b767918b9a98a08e0fcb78377e3cc3492a5079b6 100644 (file)
@@ -376,7 +376,7 @@ NCR_700_detect(struct scsi_host_template *tpnt,
        dma_sync_single_for_device(hostdata->dev, pScript, sizeof(SCRIPT), DMA_TO_DEVICE);
        hostdata->state = NCR_700_HOST_FREE;
        hostdata->cmd = NULL;
-       host->max_id = 7;
+       host->max_id = 8;
        host->max_lun = NCR_700_MAX_LUNS;
        BUG_ON(NCR_700_transport_template == NULL);
        host->transportt = NCR_700_transport_template;
index 7894b8ea84bde7341cc39a6da81c956a6740c1ab..cfc991271cc83570f1754a0a5af48096d7861f85 100644 (file)
@@ -709,7 +709,7 @@ request_synchronous (int host, int target) {
        printk (KERN_ALERT "target %d is host ID\n", target);
        return -1;
     } 
-    else if (target > h->max_id) {
+    else if (target >= h->max_id) {
        printk (KERN_ALERT "target %d exceeds maximum of %d\n", target,
            h->max_id);
        return -1;
@@ -3622,7 +3622,7 @@ NCR53c7xx_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *)) {
 #ifdef LINUX_1_2
        || cmd->device->id > 7
 #else
-       || cmd->device->id > host->max_id
+       || cmd->device->id >= host->max_id
 #endif
        || cmd->device->id == host->this_id
        || hostdata->state == STATE_DISABLED) {
index 08771f6f68594f0cb3524937b9573eb3a81056a3..e14244aa69d770d6646a298fc09e520532ab3ee0 100644 (file)
@@ -9396,8 +9396,8 @@ ahd_find_tmode_devs(struct ahd_softc *ahd, struct cam_sim *sim, union ccb *ccb,
        } else {
                u_int max_id;
 
-               max_id = (ahd->features & AHD_WIDE) ? 15 : 7;
-               if (ccb->ccb_h.target_id > max_id)
+               max_id = (ahd->features & AHD_WIDE) ? 16 : 8;
+               if (ccb->ccb_h.target_id >= max_id)
                        return (CAM_TID_INVALID);
 
                if (ccb->ccb_h.target_lun >= AHD_NUM_LUNS)
index d37566978fba5b69a9b836a1b02c8c39dd91dad8..50a3dd047cfe0c4718cbd5fd3b94dccc01f4221c 100644 (file)
@@ -6774,8 +6774,8 @@ ahc_find_tmode_devs(struct ahc_softc *ahc, struct cam_sim *sim, union ccb *ccb,
        } else {
                u_int max_id;
 
-               max_id = (ahc->features & AHC_WIDE) ? 15 : 7;
-               if (ccb->ccb_h.target_id > max_id)
+               max_id = (ahc->features & AHC_WIDE) ? 16 : 8;
+               if (ccb->ccb_h.target_id >= max_id)
                        return (CAM_TID_INVALID);
 
                if (ccb->ccb_h.target_lun >= AHC_NUM_LUNS)
index a198d86667e9070ef34e81cdaaaeecc0d191ab04..58d7e34807aab4f9ae9257228ed927af6f0a7fb3 100644 (file)
@@ -3047,7 +3047,7 @@ flash_ok_885:
                if (atp_dev.chip_ver == 4)
                        shpnt->max_id = 16;
                else            
-                       shpnt->max_id = 7;
+                       shpnt->max_id = 8;
                shpnt->this_id = host_id;
                shpnt->unique_id = base_io;
                shpnt->io_port = base_io;