aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/be2iscsi
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2011-09-26 02:23:37 -0400
committerJames Bottomley <JBottomley@Parallels.com>2011-12-15 01:57:31 -0500
commit4053a4be525d3441cad6cd1ae207177f03eb9ce7 (patch)
tree081b70eb50643040b85104aa652533ad07fa5379 /drivers/scsi/be2iscsi
parent7af0abbc2ffcae601ea14e39048901833528f104 (diff)
[SCSI] be2iscsi: cleanup a min_t() call
"sense_len" was declared as int type but actually it only stores a u16 value that comes from hardware. The cast to u16 in min_t() confuses static analysis because it truncates the int to u16 so I've fixed the declaration to reflect that "sense_len" is just a u16. Also there was a call to cpu_to_be16() which I've changed to be16_to_cpu(). The functions are equivalent, but obviously the hardware is big endian and we're doing the min_t() comparison on CPU endian values. This whole patch is just a cleanup and doesn't affect how the code works. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu> Acked-by: Jayamohan Kallickal <Jayamohan.kallickal@emulex.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/be2iscsi')
-rw-r--r--drivers/scsi/be2iscsi/be_main.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 379c696dac19..fc7c97d7e34d 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -1105,7 +1105,6 @@ be_complete_io(struct beiscsi_conn *beiscsi_conn,
1105 struct be_status_bhs *sts_bhs = 1105 struct be_status_bhs *sts_bhs =
1106 (struct be_status_bhs *)io_task->cmd_bhs; 1106 (struct be_status_bhs *)io_task->cmd_bhs;
1107 struct iscsi_conn *conn = beiscsi_conn->conn; 1107 struct iscsi_conn *conn = beiscsi_conn->conn;
1108 unsigned int sense_len;
1109 unsigned char *sense; 1108 unsigned char *sense;
1110 u32 resid = 0, exp_cmdsn, max_cmdsn; 1109 u32 resid = 0, exp_cmdsn, max_cmdsn;
1111 u8 rsp, status, flags; 1110 u8 rsp, status, flags;
@@ -1153,9 +1152,11 @@ be_complete_io(struct beiscsi_conn *beiscsi_conn,
1153 } 1152 }
1154 1153
1155 if (status == SAM_STAT_CHECK_CONDITION) { 1154 if (status == SAM_STAT_CHECK_CONDITION) {
1155 u16 sense_len;
1156 unsigned short *slen = (unsigned short *)sts_bhs->sense_info; 1156 unsigned short *slen = (unsigned short *)sts_bhs->sense_info;
1157
1157 sense = sts_bhs->sense_info + sizeof(unsigned short); 1158 sense = sts_bhs->sense_info + sizeof(unsigned short);
1158 sense_len = cpu_to_be16(*slen); 1159 sense_len = be16_to_cpu(*slen);
1159 memcpy(task->sc->sense_buffer, sense, 1160 memcpy(task->sc->sense_buffer, sense,
1160 min_t(u16, sense_len, SCSI_SENSE_BUFFERSIZE)); 1161 min_t(u16, sense_len, SCSI_SENSE_BUFFERSIZE));
1161 } 1162 }