aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorSantosh Nayak <santoshprasadnayak@gmail.com>2012-03-06 12:06:59 -0500
committerJames Bottomley <JBottomley@Parallels.com>2012-03-27 03:26:35 -0400
commit76c8ae4b2fbcbc92601c48e1b534c35638c8d597 (patch)
tree6d3e9269516b7d7a682ca406d29676fa71a2fe83 /drivers/scsi
parent6d76222e1a57deaba1562ce3d3312b5f21888bd1 (diff)
[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')
-rw-r--r--drivers/scsi/bfa/bfad_bsg.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/scsi/bfa/bfad_bsg.c b/drivers/scsi/bfa/bfad_bsg.c
index 8005c6c5a080..f62cf4981473 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,
1918 struct bfa_bsg_debug_s *iocmd = (struct bfa_bsg_debug_s *)cmd; 1918 struct bfa_bsg_debug_s *iocmd = (struct bfa_bsg_debug_s *)cmd;
1919 void *iocmd_bufptr; 1919 void *iocmd_bufptr;
1920 unsigned long flags; 1920 unsigned long flags;
1921 u32 offset;
1921 1922
1922 if (bfad_chk_iocmd_sz(payload_len, sizeof(struct bfa_bsg_debug_s), 1923 if (bfad_chk_iocmd_sz(payload_len, sizeof(struct bfa_bsg_debug_s),
1923 BFA_DEBUG_FW_CORE_CHUNK_SZ) != BFA_STATUS_OK) { 1924 BFA_DEBUG_FW_CORE_CHUNK_SZ) != BFA_STATUS_OK) {
@@ -1935,8 +1936,10 @@ bfad_iocmd_debug_fw_core(struct bfad_s *bfad, void *cmd,
1935 1936
1936 iocmd_bufptr = (char *)iocmd + sizeof(struct bfa_bsg_debug_s); 1937 iocmd_bufptr = (char *)iocmd + sizeof(struct bfa_bsg_debug_s);
1937 spin_lock_irqsave(&bfad->bfad_lock, flags); 1938 spin_lock_irqsave(&bfad->bfad_lock, flags);
1939 offset = iocmd->offset;
1938 iocmd->status = bfa_ioc_debug_fwcore(&bfad->bfa.ioc, iocmd_bufptr, 1940 iocmd->status = bfa_ioc_debug_fwcore(&bfad->bfa.ioc, iocmd_bufptr,
1939 (u32 *)&iocmd->offset, &iocmd->bufsz); 1941 &offset, &iocmd->bufsz);
1942 iocmd->offset = offset;
1940 spin_unlock_irqrestore(&bfad->bfad_lock, flags); 1943 spin_unlock_irqrestore(&bfad->bfad_lock, flags);
1941out: 1944out:
1942 return 0; 1945 return 0;