]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
sctp: merge two if statements to one
authorwangweidong <wangweidong1@huawei.com>
Sat, 26 Oct 2013 08:06:32 +0000 (16:06 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Oct 2013 05:02:34 +0000 (01:02 -0400)
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>
net/sctp/auth.c

index 8c4fa5dec8245e984ddf637134ca82265c5ddfe5..46b5977978a131b15c073f3b23ab49fa511e92bc 100644 (file)
@@ -539,18 +539,14 @@ struct sctp_hmac *sctp_auth_asoc_get_hmac(const struct sctp_association *asoc)
        for (i = 0; i < n_elt; i++) {
                id = ntohs(hmacs->hmac_ids[i]);
 
-               /* Check the id is in the supported range */
-               if (id > SCTP_AUTH_HMAC_ID_MAX) {
-                       id = 0;
-                       continue;
-               }
-
-               /* See is we support the id.  Supported IDs have name and
-                * length fields set, so that we can allocated and use
+               /* Check the id is in the supported range. And
+                * see if we support the id.  Supported IDs have name and
+                * length fields set, so that we can allocate and use
                 * them.  We can safely just check for name, for without the
                 * name, we can't allocate the TFM.
                 */
-               if (!sctp_hmac_list[id].hmac_name) {
+               if (id > SCTP_AUTH_HMAC_ID_MAX ||
+                   !sctp_hmac_list[id].hmac_name) {
                        id = 0;
                        continue;
                }