From: Daniel Borkmann <dborkman@redhat.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, linux-sctp@vger.kernel.org
Subject: [PATCH net 1/2] net: sctp: spare unnecessary comparison in sctp_trans_elect_best
Date: Fri, 22 Aug 2014 13:03:29 +0200 [thread overview]
Message-ID: <1408705410-28558-2-git-send-email-dborkman@redhat.com> (raw)
In-Reply-To: <1408705410-28558-1-git-send-email-dborkman@redhat.com>
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>
---
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);
--
1.7.11.7
next prev parent reply other threads:[~2014-08-22 11:03 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 ` Daniel Borkmann [this message]
2014-08-22 12:13 ` [PATCH net 1/2] net: sctp: spare unnecessary comparison in sctp_trans_elect_best Neil Horman
2014-08-22 14:38 ` Vlad Yasevich
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=1408705410-28558-2-git-send-email-dborkman@redhat.com \
--to=dborkman@redhat.com \
--cc=davem@davemloft.net \
--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).