[SCSI] stex: stex_internal_copy should be called with sg_count in struct st_ccb
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Fri, 22 Feb 2008 14:11:04 +0000 (23:11 +0900)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Fri, 22 Feb 2008 23:20:59 +0000 (17:20 -0600)
commitc9872fe1add5709fffd42249e6ca1080999aa06a
tree8ee1278a998220785a3eaf1ae7c3fd4ba54ced22
parent26106e3ca379e30790c41d8835e79395437152ec
[SCSI] stex: stex_internal_copy should be called with sg_count in struct st_ccb

stex_internal_copy copies an in-kernel buffer to a sg list by using
scsi_kmap_atomic_sg. Some functions calls stex_internal_copy with
sg_count in struct st_ccb, which is the value that dma_map_sg
returned. However it might be shorter than the actual number of sg
entries (if the IOMMU merged the sg entries).

scsi_kmap_atomic_sg doesn't see sg->dma_length so stex_internal_copy
should be called with the actual number of sg entries
(i.e. scsi_sg_count), because if the sg entries were merged,
stex_direct_copy wrongly think that the data length in the sg list is
shorter than the actual length.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Ed Lin <ed.lin@promise.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
drivers/scsi/stex.c