diff options
author | Jens Axboe <axboe@suse.de> | 2006-04-02 17:04:21 -0400 |
---|---|---|
committer | Jens Axboe <axboe@suse.de> | 2006-04-02 17:04:21 -0400 |
commit | 53cd9ae886273d6c2b8ba4aa63d6cd6b1217b57f (patch) | |
tree | 859162c3086f7d636ed376d4cb57522f52a8fd82 /fs/splice.c | |
parent | b043b673dc8a73daa233d5d92cf70b32e7351314 (diff) |
[PATCH] splice: fix shadow[] filling logic
Clear the entire range, and don't increment pidx or we keep filling
the same position again and again.
Thanks to KAMEZAWA Hiroyuki.
Signed-off-by: Jens Axboe <axboe@suse.de>
Diffstat (limited to 'fs/splice.c')
-rw-r--r-- | fs/splice.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/splice.c b/fs/splice.c index 6081cf7d2d1b..a555d0a83fe9 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -237,9 +237,9 @@ static int __generic_file_splice_read(struct file *in, struct inode *pipe, | |||
237 | * fill shadow[] with pages at the right locations, so we only | 237 | * fill shadow[] with pages at the right locations, so we only |
238 | * have to fill holes | 238 | * have to fill holes |
239 | */ | 239 | */ |
240 | memset(shadow, 0, i * sizeof(struct page *)); | 240 | memset(shadow, 0, nr_pages * sizeof(struct page *)); |
241 | for (j = 0, pidx = index; j < i; pidx++, j++) | 241 | for (j = 0; j < i; j++) |
242 | shadow[pages[j]->index - pidx] = pages[j]; | 242 | shadow[pages[j]->index - index] = pages[j]; |
243 | 243 | ||
244 | /* | 244 | /* |
245 | * now fill in the holes | 245 | * now fill in the holes |