aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/aacraid/aachba.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/aacraid/aachba.c')
-rw-r--r--drivers/scsi/aacraid/aachba.c40
1 files changed, 16 insertions, 24 deletions
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index aadedbd63083..9bd7173072fe 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -912,9 +912,8 @@ static int aac_bounds_32(struct aac_dev * dev, struct scsi_cmnd * cmd, u64 lba)
912 ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0, 912 ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0,
913 0, 0); 913 0, 0);
914 memcpy(cmd->sense_buffer, &dev->fsa_dev[cid].sense_data, 914 memcpy(cmd->sense_buffer, &dev->fsa_dev[cid].sense_data,
915 (sizeof(dev->fsa_dev[cid].sense_data) > SCSI_SENSE_BUFFERSIZE) 915 min_t(size_t, sizeof(dev->fsa_dev[cid].sense_data),
916 ? SCSI_SENSE_BUFFERSIZE 916 SCSI_SENSE_BUFFERSIZE));
917 : sizeof(dev->fsa_dev[cid].sense_data));
918 cmd->scsi_done(cmd); 917 cmd->scsi_done(cmd);
919 return 1; 918 return 1;
920 } 919 }
@@ -1525,9 +1524,8 @@ static void io_callback(void *context, struct fib * fibptr)
1525 ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0, 1524 ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0,
1526 0, 0); 1525 0, 0);
1527 memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data, 1526 memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data,
1528 (sizeof(dev->fsa_dev[cid].sense_data) > SCSI_SENSE_BUFFERSIZE) 1527 min_t(size_t, sizeof(dev->fsa_dev[cid].sense_data),
1529 ? SCSI_SENSE_BUFFERSIZE 1528 SCSI_SENSE_BUFFERSIZE));
1530 : sizeof(dev->fsa_dev[cid].sense_data));
1531 } 1529 }
1532 aac_fib_complete(fibptr); 1530 aac_fib_complete(fibptr);
1533 aac_fib_free(fibptr); 1531 aac_fib_free(fibptr);
@@ -1949,9 +1947,8 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
1949 SENCODE_INVALID_COMMAND, 1947 SENCODE_INVALID_COMMAND,
1950 ASENCODE_INVALID_COMMAND, 0, 0, 0, 0); 1948 ASENCODE_INVALID_COMMAND, 0, 0, 0, 0);
1951 memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data, 1949 memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data,
1952 (sizeof(dev->fsa_dev[cid].sense_data) > SCSI_SENSE_BUFFERSIZE) 1950 min_t(size_t, sizeof(dev->fsa_dev[cid].sense_data),
1953 ? SCSI_SENSE_BUFFERSIZE 1951 SCSI_SENSE_BUFFERSIZE));
1954 : sizeof(dev->fsa_dev[cid].sense_data));
1955 scsicmd->scsi_done(scsicmd); 1952 scsicmd->scsi_done(scsicmd);
1956 return 0; 1953 return 0;
1957 } 1954 }
@@ -2001,10 +1998,9 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
2001 ASENCODE_NO_SENSE, 0, 7, 2, 0); 1998 ASENCODE_NO_SENSE, 0, 7, 2, 0);
2002 memcpy(scsicmd->sense_buffer, 1999 memcpy(scsicmd->sense_buffer,
2003 &dev->fsa_dev[cid].sense_data, 2000 &dev->fsa_dev[cid].sense_data,
2004 (sizeof(dev->fsa_dev[cid].sense_data) > 2001 min_t(size_t,
2005 SCSI_SENSE_BUFFERSIZE) 2002 sizeof(dev->fsa_dev[cid].sense_data),
2006 ? SCSI_SENSE_BUFFERSIZE 2003 SCSI_SENSE_BUFFERSIZE));
2007 : sizeof(dev->fsa_dev[cid].sense_data));
2008 } 2004 }
2009 scsicmd->scsi_done(scsicmd); 2005 scsicmd->scsi_done(scsicmd);
2010 return 0; 2006 return 0;
@@ -2259,9 +2255,9 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
2259 ILLEGAL_REQUEST, SENCODE_INVALID_COMMAND, 2255 ILLEGAL_REQUEST, SENCODE_INVALID_COMMAND,
2260 ASENCODE_INVALID_COMMAND, 0, 0, 0, 0); 2256 ASENCODE_INVALID_COMMAND, 0, 0, 0, 0);
2261 memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data, 2257 memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data,
2262 (sizeof(dev->fsa_dev[cid].sense_data) > SCSI_SENSE_BUFFERSIZE) 2258 min_t(size_t,
2263 ? SCSI_SENSE_BUFFERSIZE 2259 sizeof(dev->fsa_dev[cid].sense_data),
2264 : sizeof(dev->fsa_dev[cid].sense_data)); 2260 SCSI_SENSE_BUFFERSIZE));
2265 scsicmd->scsi_done(scsicmd); 2261 scsicmd->scsi_done(scsicmd);
2266 return 0; 2262 return 0;
2267 } 2263 }
@@ -2421,10 +2417,8 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
2421 if (le32_to_cpu(srbreply->status) != ST_OK){ 2417 if (le32_to_cpu(srbreply->status) != ST_OK){
2422 int len; 2418 int len;
2423 printk(KERN_WARNING "aac_srb_callback: srb failed, status = %d\n", le32_to_cpu(srbreply->status)); 2419 printk(KERN_WARNING "aac_srb_callback: srb failed, status = %d\n", le32_to_cpu(srbreply->status));
2424 len = (le32_to_cpu(srbreply->sense_data_size) > 2420 len = min_t(u32, le32_to_cpu(srbreply->sense_data_size),
2425 SCSI_SENSE_BUFFERSIZE) ? 2421 SCSI_SENSE_BUFFERSIZE);
2426 SCSI_SENSE_BUFFERSIZE :
2427 le32_to_cpu(srbreply->sense_data_size);
2428 scsicmd->result = DID_ERROR << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_CHECK_CONDITION; 2422 scsicmd->result = DID_ERROR << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_CHECK_CONDITION;
2429 memcpy(scsicmd->sense_buffer, srbreply->sense_data, len); 2423 memcpy(scsicmd->sense_buffer, srbreply->sense_data, len);
2430 } 2424 }
@@ -2527,10 +2521,8 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
2527 if (le32_to_cpu(srbreply->scsi_status) == 0x02 ){ // Check Condition 2521 if (le32_to_cpu(srbreply->scsi_status) == 0x02 ){ // Check Condition
2528 int len; 2522 int len;
2529 scsicmd->result |= SAM_STAT_CHECK_CONDITION; 2523 scsicmd->result |= SAM_STAT_CHECK_CONDITION;
2530 len = (le32_to_cpu(srbreply->sense_data_size) > 2524 len = min_t(u32, le32_to_cpu(srbreply->sense_data_size),
2531 SCSI_SENSE_BUFFERSIZE) ? 2525 SCSI_SENSE_BUFFERSIZE);
2532 SCSI_SENSE_BUFFERSIZE :
2533 le32_to_cpu(srbreply->sense_data_size);
2534#ifdef AAC_DETAILED_STATUS_INFO 2526#ifdef AAC_DETAILED_STATUS_INFO
2535 printk(KERN_WARNING "aac_srb_callback: check condition, status = %d len=%d\n", 2527 printk(KERN_WARNING "aac_srb_callback: check condition, status = %d len=%d\n",
2536 le32_to_cpu(srbreply->status), len); 2528 le32_to_cpu(srbreply->status), len);