[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150511120616.GS8928@secunet.com>
Date: Mon, 11 May 2015 14:06:17 +0200
From: Steffen Klassert <steffen.klassert@...unet.com>
To: <roy.qing.li@...il.com>
CC: <netdev@...r.kernel.org>
Subject: Re: [PATCH][next] xfrm: optimise xfrm_policy_lookup_bytype
On Sat, May 09, 2015 at 07:17:37PM +0800, roy.qing.li@...il.com wrote:
> From: Li RongQing <roy.qing.li@...il.com>
>
> It is unnecessary to continue to loop the policy if the priority
> of current looped police is larger than priority which is from
> the policy_bydst list.
Please explain why it is unnecessary to continue with the
loop here. In general a commit message should explain why
this code is changed.
>
> Signed-off-by: Li RongQing <roy.qing.li@...il.com>
> ---
> net/xfrm/xfrm_policy.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
> index 66450c3..4adee12 100644
> --- a/net/xfrm/xfrm_policy.c
> +++ b/net/xfrm/xfrm_policy.c
> @@ -1116,6 +1116,8 @@ static struct xfrm_policy *xfrm_policy_lookup_bytype(struct net *net, u8 type,
> }
> chain = &net->xfrm.policy_inexact[dir];
> hlist_for_each_entry(pol, chain, bydst) {
> + if (pol->priority >= priority)
> + break;
priority is initialized with ~0U at the beginning of this function.
What if someone has an inexact policy with priority ~0U configured?
With your change, this policy will never match because we don't even
try to search for it.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists