提交 53cd9ae8 编写于 作者: J Jens Axboe

[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: NJens Axboe <axboe@suse.de>
上级 b043b673
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册