Skip to content

Commit 51cc9a8

Browse files
Saurav KashyapJames Bottomley
authored andcommitted
[SCSI] qla2xxx: Set the task attributes after memsetting fcp cmnd.
The memset of the fcp_cmnd struct needs to be moved so that it will not zero-out valid data. Signed-off-by: Saurav Kashyap <[email protected]> Signed-off-by: Chad Dupuis <[email protected]> Signed-off-by: James Bottomley <[email protected]>
1 parent 58b4857 commit 51cc9a8

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

drivers/scsi/qla2xxx/qla_nx.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2839,6 +2839,16 @@ qla82xx_start_scsi(srb_t *sp)
28392839
int_to_scsilun(sp->cmd->device->lun, &cmd_pkt->lun);
28402840
host_to_fcp_swap((uint8_t *)&cmd_pkt->lun, sizeof(cmd_pkt->lun));
28412841

2842+
/* build FCP_CMND IU */
2843+
memset(ctx->fcp_cmnd, 0, sizeof(struct fcp_cmnd));
2844+
int_to_scsilun(sp->cmd->device->lun, &ctx->fcp_cmnd->lun);
2845+
ctx->fcp_cmnd->additional_cdb_len = additional_cdb_len;
2846+
2847+
if (cmd->sc_data_direction == DMA_TO_DEVICE)
2848+
ctx->fcp_cmnd->additional_cdb_len |= 1;
2849+
else if (cmd->sc_data_direction == DMA_FROM_DEVICE)
2850+
ctx->fcp_cmnd->additional_cdb_len |= 2;
2851+
28422852
/*
28432853
* Update tagged queuing modifier -- default is TSK_SIMPLE (0).
28442854
*/
@@ -2855,16 +2865,6 @@ qla82xx_start_scsi(srb_t *sp)
28552865
}
28562866
}
28572867

2858-
/* build FCP_CMND IU */
2859-
memset(ctx->fcp_cmnd, 0, sizeof(struct fcp_cmnd));
2860-
int_to_scsilun(sp->cmd->device->lun, &ctx->fcp_cmnd->lun);
2861-
ctx->fcp_cmnd->additional_cdb_len = additional_cdb_len;
2862-
2863-
if (cmd->sc_data_direction == DMA_TO_DEVICE)
2864-
ctx->fcp_cmnd->additional_cdb_len |= 1;
2865-
else if (cmd->sc_data_direction == DMA_FROM_DEVICE)
2866-
ctx->fcp_cmnd->additional_cdb_len |= 2;
2867-
28682868
memcpy(ctx->fcp_cmnd->cdb, cmd->cmnd, cmd->cmd_len);
28692869

28702870
fcp_dl = (uint32_t *)(ctx->fcp_cmnd->cdb + 16 +

0 commit comments

Comments
 (0)