aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ieee1394/sbp2.c5
-rw-r--r--mm/filemap.c8
2 files changed, 8 insertions, 5 deletions
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
index 2b889d91e673..28e155a9e2a5 100644
--- a/drivers/ieee1394/sbp2.c
+++ b/drivers/ieee1394/sbp2.c
@@ -1465,10 +1465,9 @@ static void sbp2_prep_command_orb_sg(struct sbp2_command_orb *orb,
1465 orb->misc |= ORB_SET_DIRECTION(orb_direction); 1465 orb->misc |= ORB_SET_DIRECTION(orb_direction);
1466 1466
1467 /* special case if only one element (and less than 64KB in size) */ 1467 /* special case if only one element (and less than 64KB in size) */
1468 if ((scsi_use_sg == 1) && 1468 if (scsi_use_sg == 1 && sg->length <= SBP2_MAX_SG_ELEMENT_LENGTH) {
1469 (sg_dma_len(sg) <= SBP2_MAX_SG_ELEMENT_LENGTH)) {
1470 1469
1471 cmd->dma_size = sg_dma_len(sg); 1470 cmd->dma_size = sg->length;
1472 cmd->dma_type = CMD_DMA_PAGE; 1471 cmd->dma_type = CMD_DMA_PAGE;
1473 cmd->cmd_dma = dma_map_page(hi->host->device.parent, 1472 cmd->cmd_dma = dma_map_page(hi->host->device.parent,
1474 sg_page(sg), sg->offset, 1473 sg_page(sg), sg->offset,
diff --git a/mm/filemap.c b/mm/filemap.c
index 89ce6fe5f8be..76bea88cbebc 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1750,7 +1750,11 @@ static void __iov_iter_advance_iov(struct iov_iter *i, size_t bytes)
1750 const struct iovec *iov = i->iov; 1750 const struct iovec *iov = i->iov;
1751 size_t base = i->iov_offset; 1751 size_t base = i->iov_offset;
1752 1752
1753 while (bytes) { 1753 /*
1754 * The !iov->iov_len check ensures we skip over unlikely
1755 * zero-length segments.
1756 */
1757 while (bytes || !iov->iov_len) {
1754 int copy = min(bytes, iov->iov_len - base); 1758 int copy = min(bytes, iov->iov_len - base);
1755 1759
1756 bytes -= copy; 1760 bytes -= copy;
@@ -2268,6 +2272,7 @@ again:
2268 2272
2269 cond_resched(); 2273 cond_resched();
2270 2274
2275 iov_iter_advance(i, copied);
2271 if (unlikely(copied == 0)) { 2276 if (unlikely(copied == 0)) {
2272 /* 2277 /*
2273 * If we were unable to copy any data at all, we must 2278 * If we were unable to copy any data at all, we must
@@ -2281,7 +2286,6 @@ again:
2281 iov_iter_single_seg_count(i)); 2286 iov_iter_single_seg_count(i));
2282 goto again; 2287 goto again;
2283 } 2288 }
2284 iov_iter_advance(i, copied);
2285 pos += copied; 2289 pos += copied;
2286 written += copied; 2290 written += copied;
2287 2291