diff options
-rw-r--r-- | net/core/neighbour.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index a57de755c8cc..9d92e41826e7 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -2281,6 +2281,7 @@ static struct neighbour *neigh_get_idx(struct seq_file *seq, loff_t *pos) | |||
2281 | struct neighbour *n = neigh_get_first(seq); | 2281 | struct neighbour *n = neigh_get_first(seq); |
2282 | 2282 | ||
2283 | if (n) { | 2283 | if (n) { |
2284 | --(*pos); | ||
2284 | while (*pos) { | 2285 | while (*pos) { |
2285 | n = neigh_get_next(seq, n, pos); | 2286 | n = neigh_get_next(seq, n, pos); |
2286 | if (!n) | 2287 | if (!n) |
@@ -2341,6 +2342,7 @@ static struct pneigh_entry *pneigh_get_idx(struct seq_file *seq, loff_t *pos) | |||
2341 | struct pneigh_entry *pn = pneigh_get_first(seq); | 2342 | struct pneigh_entry *pn = pneigh_get_first(seq); |
2342 | 2343 | ||
2343 | if (pn) { | 2344 | if (pn) { |
2345 | --(*pos); | ||
2344 | while (*pos) { | 2346 | while (*pos) { |
2345 | pn = pneigh_get_next(seq, pn, pos); | 2347 | pn = pneigh_get_next(seq, pn, pos); |
2346 | if (!pn) | 2348 | if (!pn) |
@@ -2354,10 +2356,11 @@ static void *neigh_get_idx_any(struct seq_file *seq, loff_t *pos) | |||
2354 | { | 2356 | { |
2355 | struct neigh_seq_state *state = seq->private; | 2357 | struct neigh_seq_state *state = seq->private; |
2356 | void *rc; | 2358 | void *rc; |
2359 | loff_t idxpos = *pos; | ||
2357 | 2360 | ||
2358 | rc = neigh_get_idx(seq, pos); | 2361 | rc = neigh_get_idx(seq, &idxpos); |
2359 | if (!rc && !(state->flags & NEIGH_SEQ_NEIGH_ONLY)) | 2362 | if (!rc && !(state->flags & NEIGH_SEQ_NEIGH_ONLY)) |
2360 | rc = pneigh_get_idx(seq, pos); | 2363 | rc = pneigh_get_idx(seq, &idxpos); |
2361 | 2364 | ||
2362 | return rc; | 2365 | return rc; |
2363 | } | 2366 | } |
@@ -2366,7 +2369,6 @@ void *neigh_seq_start(struct seq_file *seq, loff_t *pos, struct neigh_table *tbl | |||
2366 | __acquires(tbl->lock) | 2369 | __acquires(tbl->lock) |
2367 | { | 2370 | { |
2368 | struct neigh_seq_state *state = seq->private; | 2371 | struct neigh_seq_state *state = seq->private; |
2369 | loff_t pos_minus_one; | ||
2370 | 2372 | ||
2371 | state->tbl = tbl; | 2373 | state->tbl = tbl; |
2372 | state->bucket = 0; | 2374 | state->bucket = 0; |
@@ -2374,8 +2376,7 @@ void *neigh_seq_start(struct seq_file *seq, loff_t *pos, struct neigh_table *tbl | |||
2374 | 2376 | ||
2375 | read_lock_bh(&tbl->lock); | 2377 | read_lock_bh(&tbl->lock); |
2376 | 2378 | ||
2377 | pos_minus_one = *pos - 1; | 2379 | return *pos ? neigh_get_idx_any(seq, pos) : SEQ_START_TOKEN; |
2378 | return *pos ? neigh_get_idx_any(seq, &pos_minus_one) : SEQ_START_TOKEN; | ||
2379 | } | 2380 | } |
2380 | EXPORT_SYMBOL(neigh_seq_start); | 2381 | EXPORT_SYMBOL(neigh_seq_start); |
2381 | 2382 | ||