aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXin Long <lucien.xin@gmail.com>2017-06-29 23:52:19 -0400
committerDavid S. Miller <davem@davemloft.net>2017-07-01 12:08:41 -0400
commit3583df1a3d7328b42cf116db3fb56b0368fab12b (patch)
tree56fbc39a98b8b7c4e608c91ab6492c3d6b03fce5
parent0664ed4378907c936fbee811efe95650d32baf34 (diff)
sctp: remove the typedef sctp_datahdr_t
This patch is to remove the typedef sctp_datahdr_t, and replace with struct sctp_datahdr in the places where it's using this typedef. It is also to use izeof(variable) instead of sizeof(type). Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/linux/sctp.h6
-rw-r--r--net/sctp/sm_statefuns.c13
2 files changed, 11 insertions, 8 deletions
diff --git a/include/linux/sctp.h b/include/linux/sctp.h
index d5c0ddadb68b..55d84c143122 100644
--- a/include/linux/sctp.h
+++ b/include/linux/sctp.h
@@ -227,17 +227,17 @@ enum { SCTP_PARAM_ACTION_MASK = cpu_to_be16(0xc000), };
227 227
228/* RFC 2960 Section 3.3.1 Payload Data (DATA) (0) */ 228/* RFC 2960 Section 3.3.1 Payload Data (DATA) (0) */
229 229
230typedef struct sctp_datahdr { 230struct sctp_datahdr {
231 __be32 tsn; 231 __be32 tsn;
232 __be16 stream; 232 __be16 stream;
233 __be16 ssn; 233 __be16 ssn;
234 __be32 ppid; 234 __be32 ppid;
235 __u8 payload[0]; 235 __u8 payload[0];
236} sctp_datahdr_t; 236};
237 237
238typedef struct sctp_data_chunk { 238typedef struct sctp_data_chunk {
239 struct sctp_chunkhdr chunk_hdr; 239 struct sctp_chunkhdr chunk_hdr;
240 sctp_datahdr_t data_hdr; 240 struct sctp_datahdr data_hdr;
241} sctp_data_chunk_t; 241} sctp_data_chunk_t;
242 242
243/* DATA Chuck Specific Flags */ 243/* DATA Chuck Specific Flags */
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index 0a01c6858b0d..1ba9a9b04466 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -3010,7 +3010,8 @@ sctp_disposition_t sctp_sf_eat_data_6_2(struct net *net,
3010 return SCTP_DISPOSITION_ABORT; 3010 return SCTP_DISPOSITION_ABORT;
3011 case SCTP_IERROR_PROTO_VIOLATION: 3011 case SCTP_IERROR_PROTO_VIOLATION:
3012 return sctp_sf_abort_violation(net, ep, asoc, chunk, commands, 3012 return sctp_sf_abort_violation(net, ep, asoc, chunk, commands,
3013 (u8 *)chunk->subh.data_hdr, sizeof(sctp_datahdr_t)); 3013 (u8 *)chunk->subh.data_hdr,
3014 sizeof(struct sctp_datahdr));
3014 default: 3015 default:
3015 BUG(); 3016 BUG();
3016 } 3017 }
@@ -3124,7 +3125,8 @@ sctp_disposition_t sctp_sf_eat_data_fast_4_4(struct net *net,
3124 return SCTP_DISPOSITION_ABORT; 3125 return SCTP_DISPOSITION_ABORT;
3125 case SCTP_IERROR_PROTO_VIOLATION: 3126 case SCTP_IERROR_PROTO_VIOLATION:
3126 return sctp_sf_abort_violation(net, ep, asoc, chunk, commands, 3127 return sctp_sf_abort_violation(net, ep, asoc, chunk, commands,
3127 (u8 *)chunk->subh.data_hdr, sizeof(sctp_datahdr_t)); 3128 (u8 *)chunk->subh.data_hdr,
3129 sizeof(struct sctp_datahdr));
3128 default: 3130 default:
3129 BUG(); 3131 BUG();
3130 } 3132 }
@@ -6197,7 +6199,7 @@ static int sctp_eat_data(const struct sctp_association *asoc,
6197 struct sctp_chunk *chunk, 6199 struct sctp_chunk *chunk,
6198 sctp_cmd_seq_t *commands) 6200 sctp_cmd_seq_t *commands)
6199{ 6201{
6200 sctp_datahdr_t *data_hdr; 6202 struct sctp_datahdr *data_hdr;
6201 struct sctp_chunk *err; 6203 struct sctp_chunk *err;
6202 size_t datalen; 6204 size_t datalen;
6203 sctp_verb_t deliver; 6205 sctp_verb_t deliver;
@@ -6210,8 +6212,9 @@ static int sctp_eat_data(const struct sctp_association *asoc,
6210 u16 sid; 6212 u16 sid;
6211 u8 ordered = 0; 6213 u8 ordered = 0;
6212 6214
6213 data_hdr = chunk->subh.data_hdr = (sctp_datahdr_t *)chunk->skb->data; 6215 data_hdr = (struct sctp_datahdr *)chunk->skb->data;
6214 skb_pull(chunk->skb, sizeof(sctp_datahdr_t)); 6216 chunk->subh.data_hdr = data_hdr;
6217 skb_pull(chunk->skb, sizeof(*data_hdr));
6215 6218
6216 tsn = ntohl(data_hdr->tsn); 6219 tsn = ntohl(data_hdr->tsn);
6217 pr_debug("%s: TSN 0x%x\n", __func__, tsn); 6220 pr_debug("%s: TSN 0x%x\n", __func__, tsn);