sctp: remove the typedef sctp_auth_chunk_t
authorXin Long <lucien.xin@gmail.com>
Thu, 3 Aug 2017 07:42:22 +0000 (15:42 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 3 Aug 2017 16:45:47 +0000 (09:45 -0700)
This patch is to remove the typedef sctp_auth_chunk_t, and
replace with struct sctp_auth_chunk in the places where it's
using this typedef.

It is also to use sizeof(variable) instead of sizeof(type).

Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/sctp.h
net/sctp/chunk.c
net/sctp/sm_statefuns.c

index b7603f5efebefd85e9590e48827c56a33563f405..82b171e1aa0b8e0f074b0300f630c909a91d6a16 100644 (file)
@@ -699,10 +699,10 @@ struct sctp_authhdr {
        __u8   hmac[0];
 };
 
-typedef struct sctp_auth_chunk {
+struct sctp_auth_chunk {
        struct sctp_chunkhdr chunk_hdr;
        struct sctp_authhdr auth_hdr;
-} sctp_auth_chunk_t;
+};
 
 struct sctp_infox {
        struct sctp_info *sctpinfo;
index 681b181e7ae3905b53500fd6c05666b362f382ee..3afac275ee82dbec825dd71378dffe69a53718a7 100644 (file)
@@ -201,7 +201,7 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc,
                struct sctp_hmac *hmac_desc = sctp_auth_asoc_get_hmac(asoc);
 
                if (hmac_desc)
-                       max_data -= SCTP_PAD4(sizeof(sctp_auth_chunk_t) +
+                       max_data -= SCTP_PAD4(sizeof(struct sctp_auth_chunk) +
                                              hmac_desc->hmac_len);
        }
 
index 9c235bb7aafe55e57c1229d50537aa6828b7d363..8af90a5f23cd829a877ac35a9e1063adc2dfdc4d 100644 (file)
@@ -4093,7 +4093,7 @@ static sctp_ierror_t sctp_sf_authenticate(struct net *net,
        /* Pull in the auth header, so we can do some more verification */
        auth_hdr = (struct sctp_authhdr *)chunk->skb->data;
        chunk->subh.auth_hdr = auth_hdr;
-       skb_pull(chunk->skb, sizeof(struct sctp_authhdr));
+       skb_pull(chunk->skb, sizeof(*auth_hdr));
 
        /* Make sure that we support the HMAC algorithm from the auth
         * chunk.
@@ -4112,7 +4112,8 @@ static sctp_ierror_t sctp_sf_authenticate(struct net *net,
        /* Make sure that the length of the signature matches what
         * we expect.
         */
-       sig_len = ntohs(chunk->chunk_hdr->length) - sizeof(sctp_auth_chunk_t);
+       sig_len = ntohs(chunk->chunk_hdr->length) -
+                 sizeof(struct sctp_auth_chunk);
        hmac = sctp_auth_get_hmac(ntohs(auth_hdr->hmac_id));
        if (sig_len != hmac->hmac_len)
                return SCTP_IERROR_PROTO_VIOLATION;
@@ -4134,8 +4135,8 @@ static sctp_ierror_t sctp_sf_authenticate(struct net *net,
        memset(digest, 0, sig_len);
 
        sctp_auth_calculate_hmac(asoc, chunk->skb,
-                               (struct sctp_auth_chunk *)chunk->chunk_hdr,
-                               GFP_ATOMIC);
+                                (struct sctp_auth_chunk *)chunk->chunk_hdr,
+                                GFP_ATOMIC);
 
        /* Discard the packet if the digests do not match */
        if (memcmp(save_digest, digest, sig_len)) {