diff options
author | Santosh Nayak <santoshprasadnayak@gmail.com> | 2012-03-06 22:36:59 +0530 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2012-03-27 08:26:35 +0100 |
commit | 76c8ae4b2fbcbc92601c48e1b534c35638c8d597 (patch) | |
tree | 6d3e9269516b7d7a682ca406d29676fa71a2fe83 /drivers/scsi/bfa | |
parent | 6d76222e1a57deaba1562ce3d3312b5f21888bd1 (diff) | |
download | op-kernel-dev-76c8ae4b2fbcbc92601c48e1b534c35638c8d597.zip op-kernel-dev-76c8ae4b2fbcbc92601c48e1b534c35638c8d597.tar.gz |
[SCSI] bfa: Fix endian bug in bfad_iocmd_debug_fw_core().
Casting pointer from native data type to other type is
endian-sensitive.
"iocmd->offset" is 64 bit but we use only first 32 bit.
It works in little-endian system but in big-endian system
it will break.
Signed-off-by: Santosh Nayak <santoshprasadnayak@gmail.com>
Acked-by: Jing Huang <huangj@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/bfa')
-rw-r--r-- | drivers/scsi/bfa/bfad_bsg.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/scsi/bfa/bfad_bsg.c b/drivers/scsi/bfa/bfad_bsg.c index 8005c6c..f62cf49 100644 --- a/drivers/scsi/bfa/bfad_bsg.c +++ b/drivers/scsi/bfa/bfad_bsg.c @@ -1918,6 +1918,7 @@ bfad_iocmd_debug_fw_core(struct bfad_s *bfad, void *cmd, struct bfa_bsg_debug_s *iocmd = (struct bfa_bsg_debug_s *)cmd; void *iocmd_bufptr; unsigned long flags; + u32 offset; if (bfad_chk_iocmd_sz(payload_len, sizeof(struct bfa_bsg_debug_s), BFA_DEBUG_FW_CORE_CHUNK_SZ) != BFA_STATUS_OK) { @@ -1935,8 +1936,10 @@ bfad_iocmd_debug_fw_core(struct bfad_s *bfad, void *cmd, iocmd_bufptr = (char *)iocmd + sizeof(struct bfa_bsg_debug_s); spin_lock_irqsave(&bfad->bfad_lock, flags); + offset = iocmd->offset; iocmd->status = bfa_ioc_debug_fwcore(&bfad->bfa.ioc, iocmd_bufptr, - (u32 *)&iocmd->offset, &iocmd->bufsz); + &offset, &iocmd->bufsz); + iocmd->offset = offset; spin_unlock_irqrestore(&bfad->bfad_lock, flags); out: return 0; |