netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vlad Yasevich <vyasevich@gmail.com>
To: Daniel Borkmann <dborkman@redhat.com>, davem@davemloft.net
Cc: netdev@vger.kernel.org, linux-sctp@vger.kernel.org
Subject: Re: [PATCH net 1/2] net: sctp: spare unnecessary comparison in sctp_trans_elect_best
Date: Fri, 22 Aug 2014 10:38:01 -0400	[thread overview]
Message-ID: <53F755C9.3020103@gmail.com> (raw)
In-Reply-To: <1408705410-28558-2-git-send-email-dborkman@redhat.com>

On 08/22/2014 07:03 AM, Daniel Borkmann wrote:
> When both transports are the same, we don't have to go down that
> road only to realize that we will return the very same transport.
> We are guaranteed that curr is always non-NULL. Therefore, just
> short-circuit this special case.
> 
> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>

Acked-by: Vlad Yasevich <vyasevich@gmail.com>

-vlad

> ---
>  net/sctp/associola.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/sctp/associola.c b/net/sctp/associola.c
> index aaafb32..104fae4 100644
> --- a/net/sctp/associola.c
> +++ b/net/sctp/associola.c
> @@ -1245,7 +1245,7 @@ static struct sctp_transport *sctp_trans_elect_best(struct sctp_transport *curr,
>  {
>  	u8 score_curr, score_best;
>  
> -	if (best == NULL)
> +	if (best == NULL || curr == best)
>  		return curr;
>  
>  	score_curr = sctp_trans_score(curr);
> 

  parent reply	other threads:[~2014-08-22 14:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-22 11:03 [PATCH net 0/2] SCTP fix Daniel Borkmann
2014-08-22 11:03 ` [PATCH net 1/2] net: sctp: spare unnecessary comparison in sctp_trans_elect_best Daniel Borkmann
2014-08-22 12:13   ` Neil Horman
2014-08-22 14:38   ` Vlad Yasevich [this message]
2014-08-22 11:03 ` [PATCH net 2/2] net: sctp: fix suboptimal edge-case on non-active active/retrans path selection Daniel Borkmann
2014-08-22 12:30   ` Neil Horman
2014-08-22 14:39   ` Vlad Yasevich
2014-08-22 18:31 ` [PATCH net 0/2] SCTP fix David Miller

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=53F755C9.3020103@gmail.com \
    --to=vyasevich@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dborkman@redhat.com \
    --cc=linux-sctp@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).