net: Fix page seeking for skb_splice_bits().
authorJarek Poplawski <jarkao2@gmail.com>
Fri, 13 Feb 2009 00:51:43 +0000 (16:51 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 13 Feb 2009 00:51:43 +0000 (16:51 -0800)
struct page walking should be done with proper accessor functions, not
directly.

With doubts from David S. Miller and Herbert Xu.

Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/skbuff.c

index 7657cec5973dde016841cf878527f6d7a1c38dc9..ab7d2e9f02fa87f4675da2b69350b7eca5ac4f8c 100644 (file)
@@ -1412,8 +1412,13 @@ static inline int spd_fill_page(struct splice_pipe_desc *spd, struct page *page,
 static inline void __segment_seek(struct page **page, unsigned int *poff,
                                  unsigned int *plen, unsigned int off)
 {
+       unsigned long n;
+
        *poff += off;
-       *page += *poff / PAGE_SIZE;
+       n = *poff / PAGE_SIZE;
+       if (n)
+               *page = nth_page(*page, n);
+
        *poff = *poff % PAGE_SIZE;
        *plen -= off;
 }