Skip to content

Commit

Permalink
scsi: qla2xxx: Fix an endian bug in fcpcmd_is_corrupted()
Browse files Browse the repository at this point in the history
We should first do the le16_to_cpu endian conversion and then apply the
FCP_CMD_LENGTH_MASK mask.

Fixes: 5f35509 ("qla2xxx: Terminate exchange if corrupted")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Quinn Tran <Quinn.Tran@cavium.com>
Acked-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
Dan Carpenter authored and Martin K. Petersen committed Sep 12, 2018
1 parent 679fcae commit cbe3fd3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/scsi/qla2xxx/qla_target.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit cbe3fd3

Please sign in to comment.