Skip to content

Commit

Permalink
net: Fix page seeking for skb_splice_bits().
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jarek Poplawski authored and David S. Miller committed Feb 13, 2009
1 parent 51621fb commit ce3dd39
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion net/core/skbuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit ce3dd39

Please sign in to comment.