diff options
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/ips.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c index 7ed568f180ae..e5467a4c225b 100644 --- a/drivers/scsi/ips.c +++ b/drivers/scsi/ips.c | |||
@@ -3510,15 +3510,16 @@ ips_scmd_buf_write(struct scsi_cmnd *scmd, void *data, unsigned int count) | |||
3510 | struct scatterlist *sg = scsi_sglist(scmd); | 3510 | struct scatterlist *sg = scsi_sglist(scmd); |
3511 | 3511 | ||
3512 | for (i = 0, xfer_cnt = 0; | 3512 | for (i = 0, xfer_cnt = 0; |
3513 | (i < scsi_sg_count(scmd)) && (xfer_cnt < count); i++) { | 3513 | (i < scsi_sg_count(scmd)) && (xfer_cnt < count); |
3514 | min_cnt = min(count - xfer_cnt, sg[i].length); | 3514 | i++, sg = sg_next(sg)) { |
3515 | min_cnt = min(count - xfer_cnt, sg->length); | ||
3515 | 3516 | ||
3516 | /* kmap_atomic() ensures addressability of the data buffer.*/ | 3517 | /* kmap_atomic() ensures addressability of the data buffer.*/ |
3517 | /* local_irq_save() protects the KM_IRQ0 address slot. */ | 3518 | /* local_irq_save() protects the KM_IRQ0 address slot. */ |
3518 | local_irq_save(flags); | 3519 | local_irq_save(flags); |
3519 | buffer = kmap_atomic(sg_page(&sg[i]), KM_IRQ0) + sg[i].offset; | 3520 | buffer = kmap_atomic(sg_page(sg), KM_IRQ0) + sg->offset; |
3520 | memcpy(buffer, &cdata[xfer_cnt], min_cnt); | 3521 | memcpy(buffer, &cdata[xfer_cnt], min_cnt); |
3521 | kunmap_atomic(buffer - sg[i].offset, KM_IRQ0); | 3522 | kunmap_atomic(buffer - sg->offset, KM_IRQ0); |
3522 | local_irq_restore(flags); | 3523 | local_irq_restore(flags); |
3523 | 3524 | ||
3524 | xfer_cnt += min_cnt; | 3525 | xfer_cnt += min_cnt; |
@@ -3543,15 +3544,16 @@ ips_scmd_buf_read(struct scsi_cmnd *scmd, void *data, unsigned int count) | |||
3543 | struct scatterlist *sg = scsi_sglist(scmd); | 3544 | struct scatterlist *sg = scsi_sglist(scmd); |
3544 | 3545 | ||
3545 | for (i = 0, xfer_cnt = 0; | 3546 | for (i = 0, xfer_cnt = 0; |
3546 | (i < scsi_sg_count(scmd)) && (xfer_cnt < count); i++) { | 3547 | (i < scsi_sg_count(scmd)) && (xfer_cnt < count); |
3547 | min_cnt = min(count - xfer_cnt, sg[i].length); | 3548 | i++, sg = sg_next(sg)) { |
3549 | min_cnt = min(count - xfer_cnt, sg->length); | ||
3548 | 3550 | ||
3549 | /* kmap_atomic() ensures addressability of the data buffer.*/ | 3551 | /* kmap_atomic() ensures addressability of the data buffer.*/ |
3550 | /* local_irq_save() protects the KM_IRQ0 address slot. */ | 3552 | /* local_irq_save() protects the KM_IRQ0 address slot. */ |
3551 | local_irq_save(flags); | 3553 | local_irq_save(flags); |
3552 | buffer = kmap_atomic(sg_page(&sg[i]), KM_IRQ0) + sg[i].offset; | 3554 | buffer = kmap_atomic(sg_page(sg), KM_IRQ0) + sg->offset; |
3553 | memcpy(&cdata[xfer_cnt], buffer, min_cnt); | 3555 | memcpy(&cdata[xfer_cnt], buffer, min_cnt); |
3554 | kunmap_atomic(buffer - sg[i].offset, KM_IRQ0); | 3556 | kunmap_atomic(buffer - sg->offset, KM_IRQ0); |
3555 | local_irq_restore(flags); | 3557 | local_irq_restore(flags); |
3556 | 3558 | ||
3557 | xfer_cnt += min_cnt; | 3559 | xfer_cnt += min_cnt; |