[PATCH] splice: fix shadow[] filling logic
[deliverable/linux.git] / fs / splice.c
index 6081cf7d2d1ba91c0b5d613904994cdd6876b8b9..a555d0a83fe95efa33a06248633869e89814e807 100644 (file)
@@ -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
This page took 0.027985 seconds and 5 git commands to generate.