summaryrefslogtreecommitdiff
path: root/net/xfrm/xfrm_state.c
diff options
context:
space:
mode:
authorLi RongQing <roy.qing.li@gmail.com>2015-04-22 12:09:54 +0300
committerSteffen Klassert <steffen.klassert@secunet.com>2015-04-23 12:36:06 +0300
commit800777026eeb33585f29608c2c6131fc66d2e218 (patch)
tree23aca36cb198fa486dbb67e7ee28191e1f597db3 /net/xfrm/xfrm_state.c
parent1ee5e6676bccbf7a035d8d35c143f1a61e602198 (diff)
downloadlinux-800777026eeb33585f29608c2c6131fc66d2e218.tar.xz
xfrm: optimise the use of walk list header in xfrm_policy/state_walk
The walk from input is the list header, and marked as dead, and will be skipped in loop. list_first_entry() can be used to return the true usable value from walk if walk is not empty Signed-off-by: Li RongQing <roy.qing.li@gmail.com> Acked-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'net/xfrm/xfrm_state.c')
-rw-r--r--net/xfrm/xfrm_state.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index f5e39e35d73a..df9318301e98 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -1626,7 +1626,7 @@ int xfrm_state_walk(struct net *net, struct xfrm_state_walk *walk,
if (list_empty(&walk->all))
x = list_first_entry(&net->xfrm.state_all, struct xfrm_state_walk, all);
else
- x = list_entry(&walk->all, struct xfrm_state_walk, all);
+ x = list_first_entry(&walk->all, struct xfrm_state_walk, all);
list_for_each_entry_from(x, &net->xfrm.state_all, all) {
if (x->state == XFRM_STATE_DEAD)
continue;