Skip to content

Commit ea4f19c

Browse files
Daniel Borkmanndavem330
authored andcommitted
net: sctp: spare unnecessary comparison in sctp_trans_elect_best
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 <[email protected]> Acked-by: Neil Horman <[email protected]> Acked-by: Vlad Yasevich <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7d149c5 commit ea4f19c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/sctp/associola.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1245,7 +1245,7 @@ static struct sctp_transport *sctp_trans_elect_best(struct sctp_transport *curr,
12451245
{
12461246
u8 score_curr, score_best;
12471247

1248-
if (best == NULL)
1248+
if (best == NULL || curr == best)
12491249
return curr;
12501250

12511251
score_curr = sctp_trans_score(curr);

0 commit comments

Comments
 (0)