All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steffen Klassert <steffen.klassert@secunet.com>
To: <roy.qing.li@gmail.com>
Cc: <netdev@vger.kernel.org>
Subject: Re: [PATCH][next] xfrm: optimise xfrm_policy_lookup_bytype
Date: Mon, 11 May 2015 14:06:17 +0200	[thread overview]
Message-ID: <20150511120616.GS8928@secunet.com> (raw)
In-Reply-To: <1431170257-18242-1-git-send-email-roy.qing.li@gmail.com>

On Sat, May 09, 2015 at 07:17:37PM +0800, roy.qing.li@gmail.com wrote:
> From: Li RongQing <roy.qing.li@gmail.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@gmail.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.

  reply	other threads:[~2015-05-11 12:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-09 11:17 [PATCH][next] xfrm: optimise xfrm_policy_lookup_bytype roy.qing.li
2015-05-11 12:06 ` Steffen Klassert [this message]
2015-05-12  8:25   ` Li RongQing
2015-05-12 11:37     ` Steffen Klassert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150511120616.GS8928@secunet.com \
    --to=steffen.klassert@secunet.com \
    --cc=netdev@vger.kernel.org \
    --cc=roy.qing.li@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.