projects/linux·commit cbe3fd39

scsi: qla2xxx: Fix an endian bug in fcpcmd_is_corrupted()

cbe3fd39 · Dan Carpenter <[email protected]> · 2018-09-08 11:42:27 +03:00

We should first do the le16_to_cpu endian conversion and then apply the
FCP_CMD_LENGTH_MASK mask.

Fixes: 5f35509db179 ("qla2xxx: Terminate exchange if corrupted")
Signed-off-by: Dan Carpenter <[email protected]>
Acked-by: Quinn Tran <[email protected]>
Acked-by: Himanshu Madhani <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
Commit
cbe3fd39d223f14b1c60c80fe9347a3dd08c2edb
Parents
679fcae4

Changes

1 files changed · +2 −2

FileStatusAddDelContent
drivers/scsi/qla2xxx/qla_target.hmodified+2−2View file

drivers/scsi/qla2xxx/qla_target.h

View file
diff --git a/drivers/scsi/qla2xxx/qla_target.h b/drivers/scsi/qla2xxx/qla_target.h
index fecf96f..199d3ba 100644
--- a/drivers/scsi/qla2xxx/qla_target.h
+++ b/drivers/scsi/qla2xxx/qla_target.h
@@ -374,8 +374,8 @@ struct atio_from_isp {
static inline int fcpcmd_is_corrupted(struct atio *atio)
{
if (atio->entry_type == ATIO_TYPE7 &&
- (le16_to_cpu(atio->attr_n_length & FCP_CMD_LENGTH_MASK) <
- FCP_CMD_LENGTH_MIN))
+ ((le16_to_cpu(atio->attr_n_length) & FCP_CMD_LENGTH_MASK) <
+ FCP_CMD_LENGTH_MIN))
return 1;
else
return 0;