diff options
author | Xin Long <lucien.xin@gmail.com> | 2017-08-03 03:42:11 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-08-03 12:45:46 -0400 |
commit | d8238d9dab8fbea22dd04f4e77639c7f7b83eef7 (patch) | |
tree | 7182858967d7ca84eb9a64ea951ee55befd8f7b1 | |
parent | ac23e68133f4570f40ec0910286ced08ced2d378 (diff) |
sctp: remove the typedef sctp_errhdr_t
This patch is to remove the typedef sctp_errhdr_t, and replace
with struct sctp_errhdr 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>
-rw-r--r-- | include/linux/sctp.h | 6 | ||||
-rw-r--r-- | include/net/sctp/sctp.h | 8 | ||||
-rw-r--r-- | net/sctp/sm_make_chunk.c | 38 | ||||
-rw-r--r-- | net/sctp/sm_sideeffect.c | 2 | ||||
-rw-r--r-- | net/sctp/sm_statefuns.c | 29 | ||||
-rw-r--r-- | net/sctp/ulpevent.c | 10 |
6 files changed, 48 insertions, 45 deletions
diff --git a/include/linux/sctp.h b/include/linux/sctp.h index 553020cbf6f7..d35bdd30fa0f 100644 --- a/include/linux/sctp.h +++ b/include/linux/sctp.h | |||
@@ -427,15 +427,15 @@ struct sctp_shutdown_chunk { | |||
427 | 427 | ||
428 | /* RFC 2960. Section 3.3.10 Operation Error (ERROR) (9) */ | 428 | /* RFC 2960. Section 3.3.10 Operation Error (ERROR) (9) */ |
429 | 429 | ||
430 | typedef struct sctp_errhdr { | 430 | struct sctp_errhdr { |
431 | __be16 cause; | 431 | __be16 cause; |
432 | __be16 length; | 432 | __be16 length; |
433 | __u8 variable[0]; | 433 | __u8 variable[0]; |
434 | } sctp_errhdr_t; | 434 | }; |
435 | 435 | ||
436 | typedef struct sctp_operr_chunk { | 436 | typedef struct sctp_operr_chunk { |
437 | struct sctp_chunkhdr chunk_hdr; | 437 | struct sctp_chunkhdr chunk_hdr; |
438 | sctp_errhdr_t err_hdr; | 438 | struct sctp_errhdr err_hdr; |
439 | } sctp_operr_chunk_t; | 439 | } sctp_operr_chunk_t; |
440 | 440 | ||
441 | /* RFC 2960 3.3.10 - Operation Error | 441 | /* RFC 2960 3.3.10 - Operation Error |
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index 45fd4c6056b5..84650fed1e6a 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h | |||
@@ -479,13 +479,13 @@ for (pos.v = chunk->member;\ | |||
479 | _sctp_walk_errors((err), (chunk_hdr), ntohs((chunk_hdr)->length)) | 479 | _sctp_walk_errors((err), (chunk_hdr), ntohs((chunk_hdr)->length)) |
480 | 480 | ||
481 | #define _sctp_walk_errors(err, chunk_hdr, end)\ | 481 | #define _sctp_walk_errors(err, chunk_hdr, end)\ |
482 | for (err = (sctp_errhdr_t *)((void *)chunk_hdr + \ | 482 | for (err = (struct sctp_errhdr *)((void *)chunk_hdr + \ |
483 | sizeof(struct sctp_chunkhdr));\ | 483 | sizeof(struct sctp_chunkhdr));\ |
484 | ((void *)err + offsetof(sctp_errhdr_t, length) + sizeof(err->length) <=\ | 484 | ((void *)err + offsetof(struct sctp_errhdr, length) + sizeof(err->length) <=\ |
485 | (void *)chunk_hdr + end) &&\ | 485 | (void *)chunk_hdr + end) &&\ |
486 | (void *)err <= (void *)chunk_hdr + end - ntohs(err->length) &&\ | 486 | (void *)err <= (void *)chunk_hdr + end - ntohs(err->length) &&\ |
487 | ntohs(err->length) >= sizeof(sctp_errhdr_t); \ | 487 | ntohs(err->length) >= sizeof(struct sctp_errhdr); \ |
488 | err = (sctp_errhdr_t *)((void *)err + SCTP_PAD4(ntohs(err->length)))) | 488 | err = (struct sctp_errhdr *)((void *)err + SCTP_PAD4(ntohs(err->length)))) |
489 | 489 | ||
490 | #define sctp_walk_fwdtsn(pos, chunk)\ | 490 | #define sctp_walk_fwdtsn(pos, chunk)\ |
491 | _sctp_walk_fwdtsn((pos), (chunk), ntohs((chunk)->chunk_hdr->length) - sizeof(struct sctp_fwdtsn_chunk)) | 491 | _sctp_walk_fwdtsn((pos), (chunk), ntohs((chunk)->chunk_hdr->length) - sizeof(struct sctp_fwdtsn_chunk)) |
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index 8f1c6b639ac1..0b2298bbb84e 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c | |||
@@ -135,14 +135,14 @@ static const struct sctp_paramhdr prsctp_param = { | |||
135 | void sctp_init_cause(struct sctp_chunk *chunk, __be16 cause_code, | 135 | void sctp_init_cause(struct sctp_chunk *chunk, __be16 cause_code, |
136 | size_t paylen) | 136 | size_t paylen) |
137 | { | 137 | { |
138 | sctp_errhdr_t err; | 138 | struct sctp_errhdr err; |
139 | __u16 len; | 139 | __u16 len; |
140 | 140 | ||
141 | /* Cause code constants are now defined in network order. */ | 141 | /* Cause code constants are now defined in network order. */ |
142 | err.cause = cause_code; | 142 | err.cause = cause_code; |
143 | len = sizeof(sctp_errhdr_t) + paylen; | 143 | len = sizeof(err) + paylen; |
144 | err.length = htons(len); | 144 | err.length = htons(len); |
145 | chunk->subh.err_hdr = sctp_addto_chunk(chunk, sizeof(sctp_errhdr_t), &err); | 145 | chunk->subh.err_hdr = sctp_addto_chunk(chunk, sizeof(err), &err); |
146 | } | 146 | } |
147 | 147 | ||
148 | /* A helper to initialize an op error inside a | 148 | /* A helper to initialize an op error inside a |
@@ -153,19 +153,19 @@ void sctp_init_cause(struct sctp_chunk *chunk, __be16 cause_code, | |||
153 | static int sctp_init_cause_fixed(struct sctp_chunk *chunk, __be16 cause_code, | 153 | static int sctp_init_cause_fixed(struct sctp_chunk *chunk, __be16 cause_code, |
154 | size_t paylen) | 154 | size_t paylen) |
155 | { | 155 | { |
156 | sctp_errhdr_t err; | 156 | struct sctp_errhdr err; |
157 | __u16 len; | 157 | __u16 len; |
158 | 158 | ||
159 | /* Cause code constants are now defined in network order. */ | 159 | /* Cause code constants are now defined in network order. */ |
160 | err.cause = cause_code; | 160 | err.cause = cause_code; |
161 | len = sizeof(sctp_errhdr_t) + paylen; | 161 | len = sizeof(err) + paylen; |
162 | err.length = htons(len); | 162 | err.length = htons(len); |
163 | 163 | ||
164 | if (skb_tailroom(chunk->skb) < len) | 164 | if (skb_tailroom(chunk->skb) < len) |
165 | return -ENOSPC; | 165 | return -ENOSPC; |
166 | chunk->subh.err_hdr = sctp_addto_chunk_fixed(chunk, | 166 | |
167 | sizeof(sctp_errhdr_t), | 167 | chunk->subh.err_hdr = sctp_addto_chunk_fixed(chunk, sizeof(err), &err); |
168 | &err); | 168 | |
169 | return 0; | 169 | return 0; |
170 | } | 170 | } |
171 | /* 3.3.2 Initiation (INIT) (1) | 171 | /* 3.3.2 Initiation (INIT) (1) |
@@ -979,8 +979,8 @@ struct sctp_chunk *sctp_make_abort_no_data( | |||
979 | struct sctp_chunk *retval; | 979 | struct sctp_chunk *retval; |
980 | __be32 payload; | 980 | __be32 payload; |
981 | 981 | ||
982 | retval = sctp_make_abort(asoc, chunk, sizeof(sctp_errhdr_t) | 982 | retval = sctp_make_abort(asoc, chunk, |
983 | + sizeof(tsn)); | 983 | sizeof(struct sctp_errhdr) + sizeof(tsn)); |
984 | 984 | ||
985 | if (!retval) | 985 | if (!retval) |
986 | goto no_mem; | 986 | goto no_mem; |
@@ -1015,7 +1015,8 @@ struct sctp_chunk *sctp_make_abort_user(const struct sctp_association *asoc, | |||
1015 | void *payload = NULL; | 1015 | void *payload = NULL; |
1016 | int err; | 1016 | int err; |
1017 | 1017 | ||
1018 | retval = sctp_make_abort(asoc, NULL, sizeof(sctp_errhdr_t) + paylen); | 1018 | retval = sctp_make_abort(asoc, NULL, |
1019 | sizeof(struct sctp_errhdr) + paylen); | ||
1019 | if (!retval) | 1020 | if (!retval) |
1020 | goto err_chunk; | 1021 | goto err_chunk; |
1021 | 1022 | ||
@@ -1080,8 +1081,8 @@ struct sctp_chunk *sctp_make_abort_violation( | |||
1080 | struct sctp_chunk *retval; | 1081 | struct sctp_chunk *retval; |
1081 | struct sctp_paramhdr phdr; | 1082 | struct sctp_paramhdr phdr; |
1082 | 1083 | ||
1083 | retval = sctp_make_abort(asoc, chunk, sizeof(sctp_errhdr_t) + paylen + | 1084 | retval = sctp_make_abort(asoc, chunk, sizeof(struct sctp_errhdr) + |
1084 | sizeof(phdr)); | 1085 | paylen + sizeof(phdr)); |
1085 | if (!retval) | 1086 | if (!retval) |
1086 | goto end; | 1087 | goto end; |
1087 | 1088 | ||
@@ -1104,7 +1105,7 @@ struct sctp_chunk *sctp_make_violation_paramlen( | |||
1104 | { | 1105 | { |
1105 | struct sctp_chunk *retval; | 1106 | struct sctp_chunk *retval; |
1106 | static const char error[] = "The following parameter had invalid length:"; | 1107 | static const char error[] = "The following parameter had invalid length:"; |
1107 | size_t payload_len = sizeof(error) + sizeof(sctp_errhdr_t) + | 1108 | size_t payload_len = sizeof(error) + sizeof(struct sctp_errhdr) + |
1108 | sizeof(*param); | 1109 | sizeof(*param); |
1109 | 1110 | ||
1110 | retval = sctp_make_abort(asoc, chunk, payload_len); | 1111 | retval = sctp_make_abort(asoc, chunk, payload_len); |
@@ -1126,7 +1127,7 @@ struct sctp_chunk *sctp_make_violation_max_retrans( | |||
1126 | { | 1127 | { |
1127 | struct sctp_chunk *retval; | 1128 | struct sctp_chunk *retval; |
1128 | static const char error[] = "Association exceeded its max_retans count"; | 1129 | static const char error[] = "Association exceeded its max_retans count"; |
1129 | size_t payload_len = sizeof(error) + sizeof(sctp_errhdr_t); | 1130 | size_t payload_len = sizeof(error) + sizeof(struct sctp_errhdr); |
1130 | 1131 | ||
1131 | retval = sctp_make_abort(asoc, chunk, payload_len); | 1132 | retval = sctp_make_abort(asoc, chunk, payload_len); |
1132 | if (!retval) | 1133 | if (!retval) |
@@ -1209,7 +1210,8 @@ static struct sctp_chunk *sctp_make_op_error_space( | |||
1209 | struct sctp_chunk *retval; | 1210 | struct sctp_chunk *retval; |
1210 | 1211 | ||
1211 | retval = sctp_make_control(asoc, SCTP_CID_ERROR, 0, | 1212 | retval = sctp_make_control(asoc, SCTP_CID_ERROR, 0, |
1212 | sizeof(sctp_errhdr_t) + size, GFP_ATOMIC); | 1213 | sizeof(struct sctp_errhdr) + size, |
1214 | GFP_ATOMIC); | ||
1213 | if (!retval) | 1215 | if (!retval) |
1214 | goto nodata; | 1216 | goto nodata; |
1215 | 1217 | ||
@@ -2966,7 +2968,7 @@ static void sctp_add_asconf_response(struct sctp_chunk *chunk, __be32 crr_id, | |||
2966 | __be16 err_code, sctp_addip_param_t *asconf_param) | 2968 | __be16 err_code, sctp_addip_param_t *asconf_param) |
2967 | { | 2969 | { |
2968 | sctp_addip_param_t ack_param; | 2970 | sctp_addip_param_t ack_param; |
2969 | sctp_errhdr_t err_param; | 2971 | struct sctp_errhdr err_param; |
2970 | int asconf_param_len = 0; | 2972 | int asconf_param_len = 0; |
2971 | int err_param_len = 0; | 2973 | int err_param_len = 0; |
2972 | __be16 response_type; | 2974 | __be16 response_type; |
@@ -3351,7 +3353,7 @@ static __be16 sctp_get_asconf_response(struct sctp_chunk *asconf_ack, | |||
3351 | int no_err) | 3353 | int no_err) |
3352 | { | 3354 | { |
3353 | sctp_addip_param_t *asconf_ack_param; | 3355 | sctp_addip_param_t *asconf_ack_param; |
3354 | sctp_errhdr_t *err_param; | 3356 | struct sctp_errhdr *err_param; |
3355 | int length; | 3357 | int length; |
3356 | int asconf_ack_len; | 3358 | int asconf_ack_len; |
3357 | __be16 err_code; | 3359 | __be16 err_code; |
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c index d6e5e9e0fd6d..5dda8c42b5f6 100644 --- a/net/sctp/sm_sideeffect.c +++ b/net/sctp/sm_sideeffect.c | |||
@@ -828,7 +828,7 @@ static void sctp_cmd_assoc_update(sctp_cmd_seq_t *cmds, | |||
828 | if (!sctp_assoc_update(asoc, new)) | 828 | if (!sctp_assoc_update(asoc, new)) |
829 | return; | 829 | return; |
830 | 830 | ||
831 | abort = sctp_make_abort(asoc, NULL, sizeof(sctp_errhdr_t)); | 831 | abort = sctp_make_abort(asoc, NULL, sizeof(struct sctp_errhdr)); |
832 | if (abort) { | 832 | if (abort) { |
833 | sctp_init_cause(abort, SCTP_ERROR_RSRC_LOW, 0); | 833 | sctp_init_cause(abort, SCTP_ERROR_RSRC_LOW, 0); |
834 | sctp_add_cmd_sf(cmds, SCTP_CMD_REPLY, SCTP_CHUNK(abort)); | 834 | sctp_add_cmd_sf(cmds, SCTP_CMD_REPLY, SCTP_CHUNK(abort)); |
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index d4d8fab52a11..7a2ba4c187d0 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c | |||
@@ -1233,7 +1233,7 @@ static int sctp_sf_send_restart_abort(struct net *net, union sctp_addr *ssa, | |||
1233 | union sctp_addr_param *addrparm; | 1233 | union sctp_addr_param *addrparm; |
1234 | struct sctp_errhdr *errhdr; | 1234 | struct sctp_errhdr *errhdr; |
1235 | struct sctp_endpoint *ep; | 1235 | struct sctp_endpoint *ep; |
1236 | char buffer[sizeof(struct sctp_errhdr)+sizeof(union sctp_addr_param)]; | 1236 | char buffer[sizeof(*errhdr) + sizeof(*addrparm)]; |
1237 | struct sctp_af *af = sctp_get_af_specific(ssa->v4.sin_family); | 1237 | struct sctp_af *af = sctp_get_af_specific(ssa->v4.sin_family); |
1238 | 1238 | ||
1239 | /* Build the error on the stack. We are way to malloc crazy | 1239 | /* Build the error on the stack. We are way to malloc crazy |
@@ -1244,7 +1244,7 @@ static int sctp_sf_send_restart_abort(struct net *net, union sctp_addr *ssa, | |||
1244 | 1244 | ||
1245 | /* Copy into a parm format. */ | 1245 | /* Copy into a parm format. */ |
1246 | len = af->to_addr_param(ssa, addrparm); | 1246 | len = af->to_addr_param(ssa, addrparm); |
1247 | len += sizeof(sctp_errhdr_t); | 1247 | len += sizeof(*errhdr); |
1248 | 1248 | ||
1249 | errhdr->cause = SCTP_ERROR_RESTART; | 1249 | errhdr->cause = SCTP_ERROR_RESTART; |
1250 | errhdr->length = htons(len); | 1250 | errhdr->length = htons(len); |
@@ -2270,7 +2270,7 @@ sctp_disposition_t sctp_sf_cookie_echoed_err(struct net *net, | |||
2270 | sctp_cmd_seq_t *commands) | 2270 | sctp_cmd_seq_t *commands) |
2271 | { | 2271 | { |
2272 | struct sctp_chunk *chunk = arg; | 2272 | struct sctp_chunk *chunk = arg; |
2273 | sctp_errhdr_t *err; | 2273 | struct sctp_errhdr *err; |
2274 | 2274 | ||
2275 | if (!sctp_vtag_verify(chunk, asoc)) | 2275 | if (!sctp_vtag_verify(chunk, asoc)) |
2276 | return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); | 2276 | return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); |
@@ -2337,7 +2337,7 @@ static sctp_disposition_t sctp_sf_do_5_2_6_stale(struct net *net, | |||
2337 | struct sctp_chunk *chunk = arg, *reply; | 2337 | struct sctp_chunk *chunk = arg, *reply; |
2338 | struct sctp_cookie_preserve_param bht; | 2338 | struct sctp_cookie_preserve_param bht; |
2339 | struct sctp_bind_addr *bp; | 2339 | struct sctp_bind_addr *bp; |
2340 | sctp_errhdr_t *err; | 2340 | struct sctp_errhdr *err; |
2341 | u32 stale; | 2341 | u32 stale; |
2342 | 2342 | ||
2343 | if (attempts > asoc->max_init_attempts) { | 2343 | if (attempts > asoc->max_init_attempts) { |
@@ -2348,7 +2348,7 @@ static sctp_disposition_t sctp_sf_do_5_2_6_stale(struct net *net, | |||
2348 | return SCTP_DISPOSITION_DELETE_TCB; | 2348 | return SCTP_DISPOSITION_DELETE_TCB; |
2349 | } | 2349 | } |
2350 | 2350 | ||
2351 | err = (sctp_errhdr_t *)(chunk->skb->data); | 2351 | err = (struct sctp_errhdr *)(chunk->skb->data); |
2352 | 2352 | ||
2353 | /* When calculating the time extension, an implementation | 2353 | /* When calculating the time extension, an implementation |
2354 | * SHOULD use the RTT information measured based on the | 2354 | * SHOULD use the RTT information measured based on the |
@@ -2364,7 +2364,7 @@ static sctp_disposition_t sctp_sf_do_5_2_6_stale(struct net *net, | |||
2364 | * to give ample time to retransmit the new cookie and thus | 2364 | * to give ample time to retransmit the new cookie and thus |
2365 | * yield a higher probability of success on the reattempt. | 2365 | * yield a higher probability of success on the reattempt. |
2366 | */ | 2366 | */ |
2367 | stale = ntohl(*(__be32 *)((u8 *)err + sizeof(sctp_errhdr_t))); | 2367 | stale = ntohl(*(__be32 *)((u8 *)err + sizeof(*err))); |
2368 | stale = (stale * 2) / 1000; | 2368 | stale = (stale * 2) / 1000; |
2369 | 2369 | ||
2370 | bht.param_hdr.type = SCTP_PARAM_COOKIE_PRESERVATIVE; | 2370 | bht.param_hdr.type = SCTP_PARAM_COOKIE_PRESERVATIVE; |
@@ -2499,13 +2499,14 @@ static sctp_disposition_t __sctp_sf_do_9_1_abort(struct net *net, | |||
2499 | /* See if we have an error cause code in the chunk. */ | 2499 | /* See if we have an error cause code in the chunk. */ |
2500 | len = ntohs(chunk->chunk_hdr->length); | 2500 | len = ntohs(chunk->chunk_hdr->length); |
2501 | if (len >= sizeof(struct sctp_chunkhdr) + sizeof(struct sctp_errhdr)) { | 2501 | if (len >= sizeof(struct sctp_chunkhdr) + sizeof(struct sctp_errhdr)) { |
2502 | struct sctp_errhdr *err; | ||
2502 | 2503 | ||
2503 | sctp_errhdr_t *err; | ||
2504 | sctp_walk_errors(err, chunk->chunk_hdr); | 2504 | sctp_walk_errors(err, chunk->chunk_hdr); |
2505 | if ((void *)err != (void *)chunk->chunk_end) | 2505 | if ((void *)err != (void *)chunk->chunk_end) |
2506 | return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); | 2506 | return sctp_sf_pdiscard(net, ep, asoc, type, arg, |
2507 | commands); | ||
2507 | 2508 | ||
2508 | error = ((sctp_errhdr_t *)chunk->skb->data)->cause; | 2509 | error = ((struct sctp_errhdr *)chunk->skb->data)->cause; |
2509 | } | 2510 | } |
2510 | 2511 | ||
2511 | sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, SCTP_ERROR(ECONNRESET)); | 2512 | sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, SCTP_ERROR(ECONNRESET)); |
@@ -2552,7 +2553,7 @@ sctp_disposition_t sctp_sf_cookie_wait_abort(struct net *net, | |||
2552 | /* See if we have an error cause code in the chunk. */ | 2553 | /* See if we have an error cause code in the chunk. */ |
2553 | len = ntohs(chunk->chunk_hdr->length); | 2554 | len = ntohs(chunk->chunk_hdr->length); |
2554 | if (len >= sizeof(struct sctp_chunkhdr) + sizeof(struct sctp_errhdr)) | 2555 | if (len >= sizeof(struct sctp_chunkhdr) + sizeof(struct sctp_errhdr)) |
2555 | error = ((sctp_errhdr_t *)chunk->skb->data)->cause; | 2556 | error = ((struct sctp_errhdr *)chunk->skb->data)->cause; |
2556 | 2557 | ||
2557 | return sctp_stop_t1_and_abort(net, commands, error, ECONNREFUSED, asoc, | 2558 | return sctp_stop_t1_and_abort(net, commands, error, ECONNREFUSED, asoc, |
2558 | chunk->transport); | 2559 | chunk->transport); |
@@ -3310,7 +3311,7 @@ sctp_disposition_t sctp_sf_operr_notify(struct net *net, | |||
3310 | sctp_cmd_seq_t *commands) | 3311 | sctp_cmd_seq_t *commands) |
3311 | { | 3312 | { |
3312 | struct sctp_chunk *chunk = arg; | 3313 | struct sctp_chunk *chunk = arg; |
3313 | sctp_errhdr_t *err; | 3314 | struct sctp_errhdr *err; |
3314 | 3315 | ||
3315 | if (!sctp_vtag_verify(chunk, asoc)) | 3316 | if (!sctp_vtag_verify(chunk, asoc)) |
3316 | return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); | 3317 | return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); |
@@ -3433,7 +3434,7 @@ sctp_disposition_t sctp_sf_ootb(struct net *net, | |||
3433 | struct sctp_chunk *chunk = arg; | 3434 | struct sctp_chunk *chunk = arg; |
3434 | struct sk_buff *skb = chunk->skb; | 3435 | struct sk_buff *skb = chunk->skb; |
3435 | struct sctp_chunkhdr *ch; | 3436 | struct sctp_chunkhdr *ch; |
3436 | sctp_errhdr_t *err; | 3437 | struct sctp_errhdr *err; |
3437 | __u8 *ch_end; | 3438 | __u8 *ch_end; |
3438 | int ootb_shut_ack = 0; | 3439 | int ootb_shut_ack = 0; |
3439 | int ootb_cookie_ack = 0; | 3440 | int ootb_cookie_ack = 0; |
@@ -3776,7 +3777,7 @@ sctp_disposition_t sctp_sf_do_asconf_ack(struct net *net, | |||
3776 | if (ADDIP_SERIAL_gte(rcvd_serial, sent_serial + 1) && | 3777 | if (ADDIP_SERIAL_gte(rcvd_serial, sent_serial + 1) && |
3777 | !(asoc->addip_last_asconf)) { | 3778 | !(asoc->addip_last_asconf)) { |
3778 | abort = sctp_make_abort(asoc, asconf_ack, | 3779 | abort = sctp_make_abort(asoc, asconf_ack, |
3779 | sizeof(sctp_errhdr_t)); | 3780 | sizeof(struct sctp_errhdr)); |
3780 | if (abort) { | 3781 | if (abort) { |
3781 | sctp_init_cause(abort, SCTP_ERROR_ASCONF_ACK, 0); | 3782 | sctp_init_cause(abort, SCTP_ERROR_ASCONF_ACK, 0); |
3782 | sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, | 3783 | sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, |
@@ -3812,7 +3813,7 @@ sctp_disposition_t sctp_sf_do_asconf_ack(struct net *net, | |||
3812 | } | 3813 | } |
3813 | 3814 | ||
3814 | abort = sctp_make_abort(asoc, asconf_ack, | 3815 | abort = sctp_make_abort(asoc, asconf_ack, |
3815 | sizeof(sctp_errhdr_t)); | 3816 | sizeof(struct sctp_errhdr)); |
3816 | if (abort) { | 3817 | if (abort) { |
3817 | sctp_init_cause(abort, SCTP_ERROR_RSRC_LOW, 0); | 3818 | sctp_init_cause(abort, SCTP_ERROR_RSRC_LOW, 0); |
3818 | sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, | 3819 | sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, |
diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c index 5f86c5062a98..67abc0194f30 100644 --- a/net/sctp/ulpevent.c +++ b/net/sctp/ulpevent.c | |||
@@ -371,19 +371,19 @@ sctp_ulpevent_make_remote_error(const struct sctp_association *asoc, | |||
371 | struct sctp_chunk *chunk, __u16 flags, | 371 | struct sctp_chunk *chunk, __u16 flags, |
372 | gfp_t gfp) | 372 | gfp_t gfp) |
373 | { | 373 | { |
374 | struct sctp_ulpevent *event; | ||
375 | struct sctp_remote_error *sre; | 374 | struct sctp_remote_error *sre; |
375 | struct sctp_ulpevent *event; | ||
376 | struct sctp_errhdr *ch; | ||
376 | struct sk_buff *skb; | 377 | struct sk_buff *skb; |
377 | sctp_errhdr_t *ch; | ||
378 | __be16 cause; | 378 | __be16 cause; |
379 | int elen; | 379 | int elen; |
380 | 380 | ||
381 | ch = (sctp_errhdr_t *)(chunk->skb->data); | 381 | ch = (struct sctp_errhdr *)(chunk->skb->data); |
382 | cause = ch->cause; | 382 | cause = ch->cause; |
383 | elen = SCTP_PAD4(ntohs(ch->length)) - sizeof(sctp_errhdr_t); | 383 | elen = SCTP_PAD4(ntohs(ch->length)) - sizeof(*ch); |
384 | 384 | ||
385 | /* Pull off the ERROR header. */ | 385 | /* Pull off the ERROR header. */ |
386 | skb_pull(chunk->skb, sizeof(sctp_errhdr_t)); | 386 | skb_pull(chunk->skb, sizeof(*ch)); |
387 | 387 | ||
388 | /* Copy the skb to a new skb with room for us to prepend | 388 | /* Copy the skb to a new skb with room for us to prepend |
389 | * notification with. | 389 | * notification with. |