[SCSI] stex: stex_direct_copy shouldn't call dma_map_sg
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Fri, 22 Feb 2008 14:11:03 +0000 (23:11 +0900)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Fri, 22 Feb 2008 23:20:39 +0000 (17:20 -0600)
commit26106e3ca379e30790c41d8835e79395437152ec
treec3f7825595819d4d607b642499616d3e5055bcb4
parenteafe1df9e311034cce204e43c0e45c91723b802f
[SCSI] stex: stex_direct_copy shouldn't call dma_map_sg

stex_direct_copy copies an in-kernel buffer to a sg list in order to
spoof some SCSI commands. stex_direct_copy calls dma_map_sg and then
stex_internal_copy with the value that dma_map_sg returned. It calls
scsi_kmap_atomic_sg to copy data.

scsi_kmap_atomic_sg doesn't see sg->dma_length so if dma_map_sg merges
sg entries, stex_internal_copy gets the smaller number of sg entries
than the acutual number, which means it wrongly think that the data
length in the sg list is shorter than the actual length.

stex_direct_copy shouldn't call dma_map_sg and it doesn't need since
this code path doesn't involve dma transfers. This patch removes
stex_direct_copy and simply calls stex_internal_copy with the actual
number of sg entries.

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