sctp: remove the typedef sctp_initack_chunk_t
authorXin Long <lucien.xin@gmail.com>
Sun, 23 Jul 2017 01:34:26 +0000 (09:34 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 24 Jul 2017 23:01:19 +0000 (16:01 -0700)
This patch is to remove the typedef sctp_initack_chunk_t, and
replace with struct sctp_initack_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/sm_statefuns.c

index 913474dfc96c4723fae79dae803ce7540e34f95b..05c2099be537def054f67b5bd9f71d8ca27dcd07 100644 (file)
@@ -336,7 +336,10 @@ struct sctp_hmac_algo_param {
  *   The INIT ACK chunk is used to acknowledge the initiation of an SCTP
  *   association.
  */
-typedef struct sctp_init_chunk sctp_initack_chunk_t;
+struct sctp_initack_chunk {
+       struct sctp_chunkhdr chunk_hdr;
+       struct sctp_inithdr init_hdr;
+};
 
 /* Section 3.3.3.1 State Cookie (7) */
 typedef struct sctp_cookie_param {
index ae4c48c4f657dc9323fed2697f97a6a6eb73722d..6568fc39590159bb79d0f2888df9475dee1451e4 100644 (file)
@@ -518,7 +518,7 @@ sctp_disposition_t sctp_sf_do_5_1C_ack(struct net *net,
                return sctp_sf_violation_chunk(net, ep, asoc, type, arg, commands);
 
        /* Make sure that the INIT-ACK chunk has a valid length */
-       if (!sctp_chunk_length_valid(chunk, sizeof(sctp_initack_chunk_t)))
+       if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_initack_chunk)))
                return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
                                                  commands);
        /* Grab the INIT header.  */
@@ -4453,11 +4453,10 @@ static sctp_disposition_t sctp_sf_abort_violation(
                /* Treat INIT-ACK as a special case during COOKIE-WAIT. */
                if (chunk->chunk_hdr->type == SCTP_CID_INIT_ACK &&
                    !asoc->peer.i.init_tag) {
-                       sctp_initack_chunk_t *initack;
+                       struct sctp_initack_chunk *initack;
 
-                       initack = (sctp_initack_chunk_t *)chunk->chunk_hdr;
-                       if (!sctp_chunk_length_valid(chunk,
-                                                    sizeof(sctp_initack_chunk_t)))
+                       initack = (struct sctp_initack_chunk *)chunk->chunk_hdr;
+                       if (!sctp_chunk_length_valid(chunk, sizeof(*initack)))
                                abort->chunk_hdr->flags |= SCTP_CHUNK_FLAG_T;
                        else {
                                unsigned int inittag;
@@ -6106,9 +6105,9 @@ static struct sctp_packet *sctp_ootb_pkt_new(struct net *net,
                switch (chunk->chunk_hdr->type) {
                case SCTP_CID_INIT_ACK:
                {
-                       sctp_initack_chunk_t *initack;
+                       struct sctp_initack_chunk *initack;
 
-                       initack = (sctp_initack_chunk_t *)chunk->chunk_hdr;
+                       initack = (struct sctp_initack_chunk *)chunk->chunk_hdr;
                        vtag = ntohl(initack->init_hdr.init_tag);
                        break;
                }