aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/dpt_i2o.c
diff options
context:
space:
mode:
authorMiquel van Smoorenburg <mikevs@xs4all.net>2008-11-04 18:09:12 -0500
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-11-15 12:10:14 -0500
commitdf81d2371aeca0f7474f197a3090830899016e39 (patch)
tree5a78d77e9086b52069789d1f0707cf9d9cb4b71e /drivers/scsi/dpt_i2o.c
parent939c2288c35132fe340b2694c7d02cacf7593723 (diff)
[SCSI] dpt_i2o: fix transferred data length for scsi_set_resid()
dpt_i2o.c::adpt_i2o_to_scsi() reads the value at (reply+5) which should contain the length in bytes of the transferred data. This would be correct if reply was a u32 *. However it is a void * here, so we need to read the value at (reply+20) instead. The value at (reply+5) is usually 0xff0000, which is apparently 'large enough' and didn't cause any trouble until 2.6.27 where commit 427e59f09fdba387547106de7bab980b7fff77be Author: James Bottomley <James.Bottomley@HansenPartnership.com> Date: Sat Mar 8 18:24:17 2008 -0600 [SCSI] make use of the residue value caused this to become visible through e.g. iostat -x . Signed-off-by: Miquel van Smoorenburg <mikevs@xs4all.net> Cc: Stable Tree <stable@kernel.org> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/dpt_i2o.c')
-rw-r--r--drivers/scsi/dpt_i2o.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index 8aba4fdfb522..6194ed5d02c4 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -2445,7 +2445,7 @@ static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd)
2445 hba_status = detailed_status >> 8; 2445 hba_status = detailed_status >> 8;
2446 2446
2447 // calculate resid for sg 2447 // calculate resid for sg
2448 scsi_set_resid(cmd, scsi_bufflen(cmd) - readl(reply+5)); 2448 scsi_set_resid(cmd, scsi_bufflen(cmd) - readl(reply+20));
2449 2449
2450 pHba = (adpt_hba*) cmd->device->host->hostdata[0]; 2450 pHba = (adpt_hba*) cmd->device->host->hostdata[0];
2451 2451
@@ -2456,7 +2456,7 @@ static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd)
2456 case I2O_SCSI_DSC_SUCCESS: 2456 case I2O_SCSI_DSC_SUCCESS:
2457 cmd->result = (DID_OK << 16); 2457 cmd->result = (DID_OK << 16);
2458 // handle underflow 2458 // handle underflow
2459 if(readl(reply+5) < cmd->underflow ) { 2459 if (readl(reply+20) < cmd->underflow) {
2460 cmd->result = (DID_ERROR <<16); 2460 cmd->result = (DID_ERROR <<16);
2461 printk(KERN_WARNING"%s: SCSI CMD underflow\n",pHba->name); 2461 printk(KERN_WARNING"%s: SCSI CMD underflow\n",pHba->name);
2462 } 2462 }