]> git.baikalelectronics.ru Git - kernel.git/commit
net: sctp: remove NULL check in sctp_assoc_update_retran_path
authorDaniel Borkmann <dborkman@redhat.com>
Thu, 13 Mar 2014 13:45:26 +0000 (14:45 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 13 Mar 2014 17:23:52 +0000 (13:23 -0400)
commitced0a57b86bb374c6e9e6857e9a7dc8cb1b3265f
tree94031203cc2483d344e50fd65249cb69219a1b93
parent25eb57ba781391ca6e9a377b82041a823fbb0188
net: sctp: remove NULL check in sctp_assoc_update_retran_path

This is basically just to let Coverity et al shut up. Remove an
unneeded NULL check in sctp_assoc_update_retran_path().

It is safe to remove it, because in sctp_assoc_update_retran_path()
we iterate over the list of transports, our own transport which is
asoc->peer.retran_path included. In the iteration, we skip the
list head element and transports in state SCTP_UNCONFIRMED.

Such transports came from peer addresses received in INIT/INIT-ACK
address parameters. They are not yet confirmed by a heartbeat and
not available for data transfers.

We know however that in the list of transports, even if it contains
such elements, it at least contains our asoc->peer.retran_path as
well, so even if next to that element, we only encounter
SCTP_UNCONFIRMED transports, we are always going to fall back to
asoc->peer.retran_path through sctp_trans_elect_best(), as that is
for sure not SCTP_UNCONFIRMED as per 1ee8fdb17d6b ("sctp: Do no
select unconfirmed transports for retransmissions").

Whenever we call sctp_trans_elect_best() it will give us a non-NULL
element back, and therefore when we break out of the loop, we are
guaranteed to have a non-NULL transport pointer, and can remove
the NULL check.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reported-by: Dave Jones <davej@redhat.com>
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sctp/associola.c