aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/st.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/st.c')
-rw-r--r--drivers/scsi/st.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index ce69b9efc102..98dfd6ea209c 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -3797,13 +3797,11 @@ static void buf_to_sg(struct st_buffer *STbp, unsigned int length)
3797 sg = &(STbp->sg[0]); 3797 sg = &(STbp->sg[0]);
3798 frp = STbp->frp; 3798 frp = STbp->frp;
3799 for (i=count=0; count < length; i++) { 3799 for (i=count=0; count < length; i++) {
3800 sg_set_page(&sg[i], frp[i].page);
3801 if (length - count > frp[i].length) 3800 if (length - count > frp[i].length)
3802 sg[i].length = frp[i].length; 3801 sg_set_page(&sg[i], frp[i].page, frp[i].length, 0);
3803 else 3802 else
3804 sg[i].length = length - count; 3803 sg_set_page(&sg[i], frp[i].page, length - count, 0);
3805 count += sg[i].length; 3804 count += sg[i].length;
3806 sg[i].offset = 0;
3807 } 3805 }
3808 STbp->sg_segs = i; 3806 STbp->sg_segs = i;
3809 STbp->frp_sg_current = length; 3807 STbp->frp_sg_current = length;
@@ -4446,15 +4444,13 @@ static int sgl_map_user_pages(struct scatterlist *sgl, const unsigned int max_pa
4446 } 4444 }
4447 4445
4448 /* Populate the scatter/gather list */ 4446 /* Populate the scatter/gather list */
4449 sg_set_page(&sgl[0], pages[0]); 4447 sg_set_page(&sgl[0], pages[0], 0, uaddr & ~PAGE_MASK);
4450 sgl[0].offset = uaddr & ~PAGE_MASK;
4451 if (nr_pages > 1) { 4448 if (nr_pages > 1) {
4452 sgl[0].length = PAGE_SIZE - sgl[0].offset; 4449 sgl[0].length = PAGE_SIZE - sgl[0].offset;
4453 count -= sgl[0].length; 4450 count -= sgl[0].length;
4454 for (i=1; i < nr_pages ; i++) { 4451 for (i=1; i < nr_pages ; i++) {
4455 sg_set_page(&sgl[i], pages[i]);; 4452 sg_set_page(&sgl[i], pages[i],
4456 sgl[i].offset = 0; 4453 count < PAGE_SIZE ? count : PAGE_SIZE, 0);;
4457 sgl[i].length = count < PAGE_SIZE ? count : PAGE_SIZE;
4458 count -= PAGE_SIZE; 4454 count -= PAGE_SIZE;
4459 } 4455 }
4460 } 4456 }