Re: [PATCH 3/4] target: fix s_id endianness bug

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2012-03-13 at 17:20 -0400, Jörn Engel wrote:
> I believe this code was tested on little-endian systems, so I retained
> behaviour on le.  Wants some review/testing.
> 
> Signed-off-by: Joern Engel <joern@xxxxxxxxx>
> ---
>  drivers/scsi/qla2xxx/qla_target.c |   11 ++++++-----
>  1 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
> index bec97cc..29f02e8 100644
> --- a/drivers/scsi/qla2xxx/qla_target.c
> +++ b/drivers/scsi/qla2xxx/qla_target.c
> @@ -1278,7 +1278,8 @@ static void qla_tgt_24xx_handle_abts(struct scsi_qla_host *vha,
>  {
>  	struct qla_hw_data *ha = vha->hw;
>  	struct qla_tgt_sess *sess;
> -	uint32_t tag = abts->exchange_addr_to_abort, s_id;
> +	uint32_t tag = abts->exchange_addr_to_abort;
> +	uint8_t s_id[3];
>  	int rc;
>  
>  	if (le32_to_cpu(abts->fcp_hdr_le.parameter) & ABTS_PARAM_ABORT_SEQ) {
> @@ -1300,11 +1301,11 @@ static void qla_tgt_24xx_handle_abts(struct scsi_qla_host *vha,
>  		abts->fcp_hdr_le.s_id[1], abts->fcp_hdr_le.s_id[0], tag,
>  		le32_to_cpu(abts->fcp_hdr_le.parameter));
>  
> -	memset(&s_id, 0, 3);
> -	s_id = (abts->fcp_hdr_le.s_id[0] << 16) | (abts->fcp_hdr_le.s_id[1] << 8) |
> -		abts->fcp_hdr_le.s_id[2];
> +	s_id[0] = abts->fcp_hdr_le.s_id[2];
> +	s_id[1] = abts->fcp_hdr_le.s_id[1];
> +	s_id[2] = abts->fcp_hdr_le.s_id[0];
>  
> -	sess = ha->tgt_ops->find_sess_by_s_id(vha, (unsigned char *)&s_id);
> +	sess = ha->tgt_ops->find_sess_by_s_id(vha, s_id);
>  	if (!sess) {
>  		ql_dbg(ql_dbg_tgt_mgt, vha, 0xe115, "qla_target(%d): task abort for"
>  			" non-existant session\n", vha->vp_idx);

Ok, the same thing exists in qla_tgt_abort_work():

        be_s_id = (prm->abts.fcp_hdr_le.s_id[0] << 16) |
                (prm->abts.fcp_hdr_le.s_id[1] << 8) |
                prm->abts.fcp_hdr_le.s_id[2];

        sess = ha->tgt_ops->find_sess_by_s_id(vha,
                        (unsigned char *)&be_s_id);

Fixing up this code as well.

Thanks Joern!

--nab

--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux