Skip to content

Commit

Permalink
[PATCH] splice: fix shadow[] filling logic
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jens Axboe committed Apr 2, 2006
1 parent b043b67 commit 53cd9ae
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fs/splice.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,9 @@ static int __generic_file_splice_read(struct file *in, struct inode *pipe,
* fill shadow[] with pages at the right locations, so we only
* have to fill holes
*/
memset(shadow, 0, i * sizeof(struct page *));
for (j = 0, pidx = index; j < i; pidx++, j++)
shadow[pages[j]->index - pidx] = pages[j];
memset(shadow, 0, nr_pages * sizeof(struct page *));
for (j = 0; j < i; j++)
shadow[pages[j]->index - index] = pages[j];

/*
* now fill in the holes
Expand Down

0 comments on commit 53cd9ae

Please sign in to comment.