aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/splice.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/fs/splice.c b/fs/splice.c
index 22fac87e90b3..0559e7577a04 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -275,6 +275,15 @@ __generic_file_splice_read(struct file *in, loff_t *ppos,
275 error = 0; 275 error = 0;
276 bytes = 0; 276 bytes = 0;
277 for (i = 0; i < nr_pages; i++, index++) { 277 for (i = 0; i < nr_pages; i++, index++) {
278 unsigned int this_len;
279
280 if (!len)
281 break;
282
283 /*
284 * this_len is the max we'll use from this page
285 */
286 this_len = min(len, PAGE_CACHE_SIZE - loff);
278find_page: 287find_page:
279 /* 288 /*
280 * lookup the page for this index 289 * lookup the page for this index
@@ -366,11 +375,13 @@ readpage:
366 * force quit after adding this page 375 * force quit after adding this page
367 */ 376 */
368 nr_pages = i; 377 nr_pages = i;
378 this_len = min(this_len, loff);
369 } 379 }
370 } 380 }
371fill_it: 381fill_it:
372 pages[i] = page; 382 pages[i] = page;
373 bytes += PAGE_CACHE_SIZE - loff; 383 bytes += this_len;
384 len -= this_len;
374 loff = 0; 385 loff = 0;
375 } 386 }
376 387