Skip to content

Commit 747edc0

Browse files
wangweidongdavem330
authored andcommitted
sctp: merge two if statements to one
Two if statements do the same work, we can merge them to one. And fix some typos. There is just code simplification, no functional changes. Signed-off-by: Wang Weidong <wangweidong1@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 3dc0a54 commit 747edc0

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

net/sctp/auth.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -539,18 +539,14 @@ struct sctp_hmac *sctp_auth_asoc_get_hmac(const struct sctp_association *asoc)
539539
for (i = 0; i < n_elt; i++) {
540540
id = ntohs(hmacs->hmac_ids[i]);
541541

542-
/* Check the id is in the supported range */
543-
if (id > SCTP_AUTH_HMAC_ID_MAX) {
544-
id = 0;
545-
continue;
546-
}
547-
548-
/* See is we support the id. Supported IDs have name and
549-
* length fields set, so that we can allocated and use
542+
/* Check the id is in the supported range. And
543+
* see if we support the id. Supported IDs have name and
544+
* length fields set, so that we can allocate and use
550545
* them. We can safely just check for name, for without the
551546
* name, we can't allocate the TFM.
552547
*/
553-
if (!sctp_hmac_list[id].hmac_name) {
548+
if (id > SCTP_AUTH_HMAC_ID_MAX ||
549+
!sctp_hmac_list[id].hmac_name) {
554550
id = 0;
555551
continue;
556552
}

0 commit comments

Comments
 (0)