Commit e2598dbd authored by David S. Miller's avatar David S. Miller

Merge branch 'sctp-nested-flex-arrays'

Xin Long says:

====================
sctp: fix a plenty of flexible-array-nested warnings

Paolo noticed a compile warning in SCTP,

../net/sctp/stream_sched_fc.c: note: in included file (through ../include/net/sctp/sctp.h):
../include/net/sctp/structs.h:335:41: warning: array of flexible structures

But not only this, there are actually quite a lot of such warnings in
some SCTP structs. This patchset fixes most of warnings by deleting
these nested flexible array members.

After this patchset, there are still some warnings left:

  # make C=2 CF="-Wflexible-array-nested" M=./net/sctp/
  ./include/net/sctp/structs.h:1145:41: warning: nested flexible array
  ./include/uapi/linux/sctp.h:641:34: warning: nested flexible array
  ./include/uapi/linux/sctp.h:643:34: warning: nested flexible array
  ./include/uapi/linux/sctp.h:644:33: warning: nested flexible array
  ./include/uapi/linux/sctp.h:650:40: warning: nested flexible array
  ./include/uapi/linux/sctp.h:653:39: warning: nested flexible array

the 1st is caused by __data[] in struct ip_options, not in SCTP;
the others are in uapi, and we should not touch them.

Note that instead of completely deleting it, we just leave it as a
comment in the struct, signalling to the reader that we do expect
such variable parameters over there, as Marcelo suggested.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 2f3a247c dbda0fba
...@@ -222,7 +222,7 @@ struct sctp_datahdr { ...@@ -222,7 +222,7 @@ struct sctp_datahdr {
__be16 stream; __be16 stream;
__be16 ssn; __be16 ssn;
__u32 ppid; __u32 ppid;
__u8 payload[]; /* __u8 payload[]; */
}; };
struct sctp_data_chunk { struct sctp_data_chunk {
...@@ -270,7 +270,7 @@ struct sctp_inithdr { ...@@ -270,7 +270,7 @@ struct sctp_inithdr {
__be16 num_outbound_streams; __be16 num_outbound_streams;
__be16 num_inbound_streams; __be16 num_inbound_streams;
__be32 initial_tsn; __be32 initial_tsn;
__u8 params[]; /* __u8 params[]; */
}; };
struct sctp_init_chunk { struct sctp_init_chunk {
...@@ -385,7 +385,7 @@ struct sctp_sackhdr { ...@@ -385,7 +385,7 @@ struct sctp_sackhdr {
__be32 a_rwnd; __be32 a_rwnd;
__be16 num_gap_ack_blocks; __be16 num_gap_ack_blocks;
__be16 num_dup_tsns; __be16 num_dup_tsns;
union sctp_sack_variable variable[]; /* union sctp_sack_variable variable[]; */
}; };
struct sctp_sack_chunk { struct sctp_sack_chunk {
...@@ -443,7 +443,7 @@ struct sctp_shutdown_chunk { ...@@ -443,7 +443,7 @@ struct sctp_shutdown_chunk {
struct sctp_errhdr { struct sctp_errhdr {
__be16 cause; __be16 cause;
__be16 length; __be16 length;
__u8 variable[]; /* __u8 variable[]; */
}; };
struct sctp_operr_chunk { struct sctp_operr_chunk {
...@@ -603,7 +603,7 @@ struct sctp_fwdtsn_skip { ...@@ -603,7 +603,7 @@ struct sctp_fwdtsn_skip {
struct sctp_fwdtsn_hdr { struct sctp_fwdtsn_hdr {
__be32 new_cum_tsn; __be32 new_cum_tsn;
struct sctp_fwdtsn_skip skip[]; /* struct sctp_fwdtsn_skip skip[]; */
}; };
struct sctp_fwdtsn_chunk { struct sctp_fwdtsn_chunk {
...@@ -620,7 +620,7 @@ struct sctp_ifwdtsn_skip { ...@@ -620,7 +620,7 @@ struct sctp_ifwdtsn_skip {
struct sctp_ifwdtsn_hdr { struct sctp_ifwdtsn_hdr {
__be32 new_cum_tsn; __be32 new_cum_tsn;
struct sctp_ifwdtsn_skip skip[]; /* struct sctp_ifwdtsn_skip skip[]; */
}; };
struct sctp_ifwdtsn_chunk { struct sctp_ifwdtsn_chunk {
...@@ -667,7 +667,7 @@ struct sctp_addip_param { ...@@ -667,7 +667,7 @@ struct sctp_addip_param {
struct sctp_addiphdr { struct sctp_addiphdr {
__be32 serial; __be32 serial;
__u8 params[]; /* __u8 params[]; */
}; };
struct sctp_addip_chunk { struct sctp_addip_chunk {
...@@ -727,7 +727,7 @@ struct sctp_addip_chunk { ...@@ -727,7 +727,7 @@ struct sctp_addip_chunk {
struct sctp_authhdr { struct sctp_authhdr {
__be16 shkey_id; __be16 shkey_id;
__be16 hmac_id; __be16 hmac_id;
__u8 hmac[]; /* __u8 hmac[]; */
}; };
struct sctp_auth_chunk { struct sctp_auth_chunk {
...@@ -742,7 +742,7 @@ struct sctp_infox { ...@@ -742,7 +742,7 @@ struct sctp_infox {
struct sctp_reconf_chunk { struct sctp_reconf_chunk {
struct sctp_chunkhdr chunk_hdr; struct sctp_chunkhdr chunk_hdr;
__u8 params[]; /* __u8 params[]; */
}; };
struct sctp_strreset_outreq { struct sctp_strreset_outreq {
......
...@@ -425,11 +425,11 @@ static inline bool sctp_chunk_pending(const struct sctp_chunk *chunk) ...@@ -425,11 +425,11 @@ static inline bool sctp_chunk_pending(const struct sctp_chunk *chunk)
* the chunk length to indicate when to stop. Make sure * the chunk length to indicate when to stop. Make sure
* there is room for a param header too. * there is room for a param header too.
*/ */
#define sctp_walk_params(pos, chunk, member)\ #define sctp_walk_params(pos, chunk)\
_sctp_walk_params((pos), (chunk), ntohs((chunk)->chunk_hdr.length), member) _sctp_walk_params((pos), (chunk), ntohs((chunk)->chunk_hdr.length))
#define _sctp_walk_params(pos, chunk, end, member)\ #define _sctp_walk_params(pos, chunk, end)\
for (pos.v = chunk->member;\ for (pos.v = (u8 *)(chunk + 1);\
(pos.v + offsetof(struct sctp_paramhdr, length) + sizeof(pos.p->length) <=\ (pos.v + offsetof(struct sctp_paramhdr, length) + sizeof(pos.p->length) <=\
(void *)chunk + end) &&\ (void *)chunk + end) &&\
pos.v <= (void *)chunk + end - ntohs(pos.p->length) &&\ pos.v <= (void *)chunk + end - ntohs(pos.p->length) &&\
...@@ -452,8 +452,8 @@ for (err = (struct sctp_errhdr *)((void *)chunk_hdr + \ ...@@ -452,8 +452,8 @@ for (err = (struct sctp_errhdr *)((void *)chunk_hdr + \
_sctp_walk_fwdtsn((pos), (chunk), ntohs((chunk)->chunk_hdr->length) - sizeof(struct sctp_fwdtsn_chunk)) _sctp_walk_fwdtsn((pos), (chunk), ntohs((chunk)->chunk_hdr->length) - sizeof(struct sctp_fwdtsn_chunk))
#define _sctp_walk_fwdtsn(pos, chunk, end)\ #define _sctp_walk_fwdtsn(pos, chunk, end)\
for (pos = chunk->subh.fwdtsn_hdr->skip;\ for (pos = (void *)(chunk->subh.fwdtsn_hdr + 1);\
(void *)pos <= (void *)chunk->subh.fwdtsn_hdr->skip + end - sizeof(struct sctp_fwdtsn_skip);\ (void *)pos <= (void *)(chunk->subh.fwdtsn_hdr + 1) + end - sizeof(struct sctp_fwdtsn_skip);\
pos++) pos++)
/* External references. */ /* External references. */
......
...@@ -332,7 +332,7 @@ struct sctp_cookie { ...@@ -332,7 +332,7 @@ struct sctp_cookie {
* the association TCB is re-constructed from the cookie. * the association TCB is re-constructed from the cookie.
*/ */
__u32 raw_addr_list_len; __u32 raw_addr_list_len;
struct sctp_init_chunk peer_init[]; /* struct sctp_init_chunk peer_init[]; */
}; };
......
...@@ -1597,9 +1597,10 @@ int sctp_assoc_set_bind_addr_from_cookie(struct sctp_association *asoc, ...@@ -1597,9 +1597,10 @@ int sctp_assoc_set_bind_addr_from_cookie(struct sctp_association *asoc,
struct sctp_cookie *cookie, struct sctp_cookie *cookie,
gfp_t gfp) gfp_t gfp)
{ {
int var_size2 = ntohs(cookie->peer_init->chunk_hdr.length); struct sctp_init_chunk *peer_init = (struct sctp_init_chunk *)(cookie + 1);
int var_size2 = ntohs(peer_init->chunk_hdr.length);
int var_size3 = cookie->raw_addr_list_len; int var_size3 = cookie->raw_addr_list_len;
__u8 *raw = (__u8 *)cookie->peer_init + var_size2; __u8 *raw = (__u8 *)peer_init + var_size2;
return sctp_raw_to_bind_addrs(&asoc->base.bind_addr, raw, var_size3, return sctp_raw_to_bind_addrs(&asoc->base.bind_addr, raw, var_size3,
asoc->ep->base.bind_addr.port, gfp); asoc->ep->base.bind_addr.port, gfp);
......
...@@ -738,7 +738,7 @@ void sctp_auth_calculate_hmac(const struct sctp_association *asoc, ...@@ -738,7 +738,7 @@ void sctp_auth_calculate_hmac(const struct sctp_association *asoc,
tfm = asoc->ep->auth_hmacs[hmac_id]; tfm = asoc->ep->auth_hmacs[hmac_id];
digest = auth->auth_hdr.hmac; digest = (u8 *)(&auth->auth_hdr + 1);
if (crypto_shash_setkey(tfm, &asoc_key->data[0], asoc_key->len)) if (crypto_shash_setkey(tfm, &asoc_key->data[0], asoc_key->len))
goto free; goto free;
......
...@@ -1150,7 +1150,7 @@ static struct sctp_association *__sctp_rcv_init_lookup(struct net *net, ...@@ -1150,7 +1150,7 @@ static struct sctp_association *__sctp_rcv_init_lookup(struct net *net,
init = (struct sctp_init_chunk *)skb->data; init = (struct sctp_init_chunk *)skb->data;
/* Walk the parameters looking for embedded addresses. */ /* Walk the parameters looking for embedded addresses. */
sctp_walk_params(params, init, init_hdr.params) { sctp_walk_params(params, init) {
/* Note: Ignoring hostname addresses. */ /* Note: Ignoring hostname addresses. */
af = sctp_get_af_specific(param_type2af(params.p->type)); af = sctp_get_af_specific(param_type2af(params.p->type));
......
...@@ -1231,7 +1231,7 @@ static void sctp_sack_update_unack_data(struct sctp_association *assoc, ...@@ -1231,7 +1231,7 @@ static void sctp_sack_update_unack_data(struct sctp_association *assoc,
unack_data = assoc->next_tsn - assoc->ctsn_ack_point - 1; unack_data = assoc->next_tsn - assoc->ctsn_ack_point - 1;
frags = sack->variable; frags = (union sctp_sack_variable *)(sack + 1);
for (i = 0; i < ntohs(sack->num_gap_ack_blocks); i++) { for (i = 0; i < ntohs(sack->num_gap_ack_blocks); i++) {
unack_data -= ((ntohs(frags[i].gab.end) - unack_data -= ((ntohs(frags[i].gab.end) -
ntohs(frags[i].gab.start) + 1)); ntohs(frags[i].gab.start) + 1));
...@@ -1252,7 +1252,6 @@ int sctp_outq_sack(struct sctp_outq *q, struct sctp_chunk *chunk) ...@@ -1252,7 +1252,6 @@ int sctp_outq_sack(struct sctp_outq *q, struct sctp_chunk *chunk)
struct sctp_transport *transport; struct sctp_transport *transport;
struct sctp_chunk *tchunk = NULL; struct sctp_chunk *tchunk = NULL;
struct list_head *lchunk, *transport_list, *temp; struct list_head *lchunk, *transport_list, *temp;
union sctp_sack_variable *frags = sack->variable;
__u32 sack_ctsn, ctsn, tsn; __u32 sack_ctsn, ctsn, tsn;
__u32 highest_tsn, highest_new_tsn; __u32 highest_tsn, highest_new_tsn;
__u32 sack_a_rwnd; __u32 sack_a_rwnd;
...@@ -1313,8 +1312,12 @@ int sctp_outq_sack(struct sctp_outq *q, struct sctp_chunk *chunk) ...@@ -1313,8 +1312,12 @@ int sctp_outq_sack(struct sctp_outq *q, struct sctp_chunk *chunk)
/* Get the highest TSN in the sack. */ /* Get the highest TSN in the sack. */
highest_tsn = sack_ctsn; highest_tsn = sack_ctsn;
if (gap_ack_blocks) if (gap_ack_blocks) {
union sctp_sack_variable *frags =
(union sctp_sack_variable *)(sack + 1);
highest_tsn += ntohs(frags[gap_ack_blocks - 1].gab.end); highest_tsn += ntohs(frags[gap_ack_blocks - 1].gab.end);
}
if (TSN_lt(asoc->highest_sacked, highest_tsn)) if (TSN_lt(asoc->highest_sacked, highest_tsn))
asoc->highest_sacked = highest_tsn; asoc->highest_sacked = highest_tsn;
...@@ -1789,7 +1792,7 @@ static int sctp_acked(struct sctp_sackhdr *sack, __u32 tsn) ...@@ -1789,7 +1792,7 @@ static int sctp_acked(struct sctp_sackhdr *sack, __u32 tsn)
* Block are assumed to have been received correctly. * Block are assumed to have been received correctly.
*/ */
frags = sack->variable; frags = (union sctp_sack_variable *)(sack + 1);
blocks = ntohs(sack->num_gap_ack_blocks); blocks = ntohs(sack->num_gap_ack_blocks);
tsn_offset = tsn - ctsn; tsn_offset = tsn - ctsn;
for (i = 0; i < blocks; ++i) { for (i = 0; i < blocks; ++i) {
......
...@@ -1707,11 +1707,11 @@ static struct sctp_cookie_param *sctp_pack_cookie( ...@@ -1707,11 +1707,11 @@ static struct sctp_cookie_param *sctp_pack_cookie(
ktime_get_real()); ktime_get_real());
/* Copy the peer's init packet. */ /* Copy the peer's init packet. */
memcpy(&cookie->c.peer_init[0], init_chunk->chunk_hdr, memcpy(cookie + 1, init_chunk->chunk_hdr,
ntohs(init_chunk->chunk_hdr->length)); ntohs(init_chunk->chunk_hdr->length));
/* Copy the raw local address list of the association. */ /* Copy the raw local address list of the association. */
memcpy((__u8 *)&cookie->c.peer_init[0] + memcpy((__u8 *)(cookie + 1) +
ntohs(init_chunk->chunk_hdr->length), raw_addrs, addrs_len); ntohs(init_chunk->chunk_hdr->length), raw_addrs, addrs_len);
if (sctp_sk(ep->base.sk)->hmac) { if (sctp_sk(ep->base.sk)->hmac) {
...@@ -2306,7 +2306,7 @@ int sctp_verify_init(struct net *net, const struct sctp_endpoint *ep, ...@@ -2306,7 +2306,7 @@ int sctp_verify_init(struct net *net, const struct sctp_endpoint *ep,
ntohl(peer_init->init_hdr.a_rwnd) < SCTP_DEFAULT_MINWINDOW) ntohl(peer_init->init_hdr.a_rwnd) < SCTP_DEFAULT_MINWINDOW)
return sctp_process_inv_mandatory(asoc, chunk, errp); return sctp_process_inv_mandatory(asoc, chunk, errp);
sctp_walk_params(param, peer_init, init_hdr.params) { sctp_walk_params(param, peer_init) {
if (param.p->type == SCTP_PARAM_STATE_COOKIE) if (param.p->type == SCTP_PARAM_STATE_COOKIE)
has_cookie = true; has_cookie = true;
} }
...@@ -2329,7 +2329,7 @@ int sctp_verify_init(struct net *net, const struct sctp_endpoint *ep, ...@@ -2329,7 +2329,7 @@ int sctp_verify_init(struct net *net, const struct sctp_endpoint *ep,
chunk, errp); chunk, errp);
/* Verify all the variable length parameters */ /* Verify all the variable length parameters */
sctp_walk_params(param, peer_init, init_hdr.params) { sctp_walk_params(param, peer_init) {
result = sctp_verify_param(net, ep, asoc, param, cid, result = sctp_verify_param(net, ep, asoc, param, cid,
chunk, errp); chunk, errp);
switch (result) { switch (result) {
...@@ -2381,7 +2381,7 @@ int sctp_process_init(struct sctp_association *asoc, struct sctp_chunk *chunk, ...@@ -2381,7 +2381,7 @@ int sctp_process_init(struct sctp_association *asoc, struct sctp_chunk *chunk,
src_match = 1; src_match = 1;
/* Process the initialization parameters. */ /* Process the initialization parameters. */
sctp_walk_params(param, peer_init, init_hdr.params) { sctp_walk_params(param, peer_init) {
if (!src_match && if (!src_match &&
(param.p->type == SCTP_PARAM_IPV4_ADDRESS || (param.p->type == SCTP_PARAM_IPV4_ADDRESS ||
param.p->type == SCTP_PARAM_IPV6_ADDRESS)) { param.p->type == SCTP_PARAM_IPV6_ADDRESS)) {
...@@ -3202,7 +3202,7 @@ bool sctp_verify_asconf(const struct sctp_association *asoc, ...@@ -3202,7 +3202,7 @@ bool sctp_verify_asconf(const struct sctp_association *asoc,
union sctp_params param; union sctp_params param;
addip = (struct sctp_addip_chunk *)chunk->chunk_hdr; addip = (struct sctp_addip_chunk *)chunk->chunk_hdr;
sctp_walk_params(param, addip, addip_hdr.params) { sctp_walk_params(param, addip) {
size_t length = ntohs(param.p->length); size_t length = ntohs(param.p->length);
*errp = param.p; *errp = param.p;
...@@ -3215,14 +3215,14 @@ bool sctp_verify_asconf(const struct sctp_association *asoc, ...@@ -3215,14 +3215,14 @@ bool sctp_verify_asconf(const struct sctp_association *asoc,
/* ensure there is only one addr param and it's in the /* ensure there is only one addr param and it's in the
* beginning of addip_hdr params, or we reject it. * beginning of addip_hdr params, or we reject it.
*/ */
if (param.v != addip->addip_hdr.params) if (param.v != (addip + 1))
return false; return false;
addr_param_seen = true; addr_param_seen = true;
break; break;
case SCTP_PARAM_IPV6_ADDRESS: case SCTP_PARAM_IPV6_ADDRESS:
if (length != sizeof(struct sctp_ipv6addr_param)) if (length != sizeof(struct sctp_ipv6addr_param))
return false; return false;
if (param.v != addip->addip_hdr.params) if (param.v != (addip + 1))
return false; return false;
addr_param_seen = true; addr_param_seen = true;
break; break;
...@@ -3302,7 +3302,7 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc, ...@@ -3302,7 +3302,7 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc,
goto done; goto done;
/* Process the TLVs contained within the ASCONF chunk. */ /* Process the TLVs contained within the ASCONF chunk. */
sctp_walk_params(param, addip, addip_hdr.params) { sctp_walk_params(param, addip) {
/* Skip preceeding address parameters. */ /* Skip preceeding address parameters. */
if (param.p->type == SCTP_PARAM_IPV4_ADDRESS || if (param.p->type == SCTP_PARAM_IPV4_ADDRESS ||
param.p->type == SCTP_PARAM_IPV6_ADDRESS) param.p->type == SCTP_PARAM_IPV6_ADDRESS)
...@@ -3636,7 +3636,7 @@ static struct sctp_chunk *sctp_make_reconf(const struct sctp_association *asoc, ...@@ -3636,7 +3636,7 @@ static struct sctp_chunk *sctp_make_reconf(const struct sctp_association *asoc,
return NULL; return NULL;
reconf = (struct sctp_reconf_chunk *)retval->chunk_hdr; reconf = (struct sctp_reconf_chunk *)retval->chunk_hdr;
retval->param_hdr.v = reconf->params; retval->param_hdr.v = (u8 *)(reconf + 1);
return retval; return retval;
} }
...@@ -3878,7 +3878,7 @@ bool sctp_verify_reconf(const struct sctp_association *asoc, ...@@ -3878,7 +3878,7 @@ bool sctp_verify_reconf(const struct sctp_association *asoc,
__u16 cnt = 0; __u16 cnt = 0;
hdr = (struct sctp_reconf_chunk *)chunk->chunk_hdr; hdr = (struct sctp_reconf_chunk *)chunk->chunk_hdr;
sctp_walk_params(param, hdr, params) { sctp_walk_params(param, hdr) {
__u16 length = ntohs(param.p->length); __u16 length = ntohs(param.p->length);
*errp = param.p; *errp = param.p;
......
...@@ -984,8 +984,7 @@ static void sctp_cmd_process_operr(struct sctp_cmd_seq *cmds, ...@@ -984,8 +984,7 @@ static void sctp_cmd_process_operr(struct sctp_cmd_seq *cmds,
{ {
struct sctp_chunkhdr *unk_chunk_hdr; struct sctp_chunkhdr *unk_chunk_hdr;
unk_chunk_hdr = (struct sctp_chunkhdr *) unk_chunk_hdr = (struct sctp_chunkhdr *)(err_hdr + 1);
err_hdr->variable;
switch (unk_chunk_hdr->type) { switch (unk_chunk_hdr->type) {
/* ADDIP 4.1 A9) If the peer responds to an ASCONF with /* ADDIP 4.1 A9) If the peer responds to an ASCONF with
* an ERROR chunk reporting that it did not recognized * an ERROR chunk reporting that it did not recognized
......
...@@ -794,8 +794,7 @@ enum sctp_disposition sctp_sf_do_5_1D_ce(struct net *net, ...@@ -794,8 +794,7 @@ enum sctp_disposition sctp_sf_do_5_1D_ce(struct net *net,
/* This is a brand-new association, so these are not yet side /* This is a brand-new association, so these are not yet side
* effects--it is safe to run them here. * effects--it is safe to run them here.
*/ */
peer_init = &chunk->subh.cookie_hdr->c.peer_init[0]; peer_init = (struct sctp_init_chunk *)(chunk->subh.cookie_hdr + 1);
if (!sctp_process_init(new_asoc, chunk, if (!sctp_process_init(new_asoc, chunk,
&chunk->subh.cookie_hdr->c.peer_addr, &chunk->subh.cookie_hdr->c.peer_addr,
peer_init, GFP_ATOMIC)) peer_init, GFP_ATOMIC))
...@@ -1337,7 +1336,7 @@ static int sctp_sf_send_restart_abort(struct net *net, union sctp_addr *ssa, ...@@ -1337,7 +1336,7 @@ static int sctp_sf_send_restart_abort(struct net *net, union sctp_addr *ssa,
* throughout the code today. * throughout the code today.
*/ */
errhdr = (struct sctp_errhdr *)buffer; errhdr = (struct sctp_errhdr *)buffer;
addrparm = (union sctp_addr_param *)errhdr->variable; addrparm = (union sctp_addr_param *)(errhdr + 1);
/* Copy into a parm format. */ /* Copy into a parm format. */
len = af->to_addr_param(ssa, addrparm); len = af->to_addr_param(ssa, addrparm);
...@@ -1869,8 +1868,7 @@ static enum sctp_disposition sctp_sf_do_dupcook_a( ...@@ -1869,8 +1868,7 @@ static enum sctp_disposition sctp_sf_do_dupcook_a(
/* new_asoc is a brand-new association, so these are not yet /* new_asoc is a brand-new association, so these are not yet
* side effects--it is safe to run them here. * side effects--it is safe to run them here.
*/ */
peer_init = &chunk->subh.cookie_hdr->c.peer_init[0]; peer_init = (struct sctp_init_chunk *)(chunk->subh.cookie_hdr + 1);
if (!sctp_process_init(new_asoc, chunk, sctp_source(chunk), peer_init, if (!sctp_process_init(new_asoc, chunk, sctp_source(chunk), peer_init,
GFP_ATOMIC)) GFP_ATOMIC))
goto nomem; goto nomem;
...@@ -1990,7 +1988,7 @@ static enum sctp_disposition sctp_sf_do_dupcook_b( ...@@ -1990,7 +1988,7 @@ static enum sctp_disposition sctp_sf_do_dupcook_b(
/* new_asoc is a brand-new association, so these are not yet /* new_asoc is a brand-new association, so these are not yet
* side effects--it is safe to run them here. * side effects--it is safe to run them here.
*/ */
peer_init = &chunk->subh.cookie_hdr->c.peer_init[0]; peer_init = (struct sctp_init_chunk *)(chunk->subh.cookie_hdr + 1);
if (!sctp_process_init(new_asoc, chunk, sctp_source(chunk), peer_init, if (!sctp_process_init(new_asoc, chunk, sctp_source(chunk), peer_init,
GFP_ATOMIC)) GFP_ATOMIC))
goto nomem; goto nomem;
...@@ -4142,7 +4140,7 @@ enum sctp_disposition sctp_sf_do_reconf(struct net *net, ...@@ -4142,7 +4140,7 @@ enum sctp_disposition sctp_sf_do_reconf(struct net *net,
(void *)err_param, commands); (void *)err_param, commands);
hdr = (struct sctp_reconf_chunk *)chunk->chunk_hdr; hdr = (struct sctp_reconf_chunk *)chunk->chunk_hdr;
sctp_walk_params(param, hdr, params) { sctp_walk_params(param, hdr) {
struct sctp_chunk *reply = NULL; struct sctp_chunk *reply = NULL;
struct sctp_ulpevent *ev = NULL; struct sctp_ulpevent *ev = NULL;
...@@ -4393,7 +4391,7 @@ static enum sctp_ierror sctp_sf_authenticate( ...@@ -4393,7 +4391,7 @@ static enum sctp_ierror sctp_sf_authenticate(
* 3. Compute the new digest * 3. Compute the new digest
* 4. Compare saved and new digests. * 4. Compare saved and new digests.
*/ */
digest = auth_hdr->hmac; digest = (u8 *)(auth_hdr + 1);
skb_pull(chunk->skb, sig_len); skb_pull(chunk->skb, sig_len);
save_digest = kmemdup(digest, sig_len, GFP_ATOMIC); save_digest = kmemdup(digest, sig_len, GFP_ATOMIC);
......
...@@ -491,7 +491,7 @@ static struct sctp_paramhdr *sctp_chunk_lookup_strreset_param( ...@@ -491,7 +491,7 @@ static struct sctp_paramhdr *sctp_chunk_lookup_strreset_param(
return NULL; return NULL;
hdr = (struct sctp_reconf_chunk *)chunk->chunk_hdr; hdr = (struct sctp_reconf_chunk *)chunk->chunk_hdr;
sctp_walk_params(param, hdr, params) { sctp_walk_params(param, hdr) {
/* sctp_strreset_tsnreq is actually the basic structure /* sctp_strreset_tsnreq is actually the basic structure
* of all stream reconf params, so it's safe to use it * of all stream reconf params, so it's safe to use it
* to access request_seq. * to access request_seq.
......
...@@ -1153,8 +1153,8 @@ static void sctp_generate_iftsn(struct sctp_outq *q, __u32 ctsn) ...@@ -1153,8 +1153,8 @@ static void sctp_generate_iftsn(struct sctp_outq *q, __u32 ctsn)
} }
#define _sctp_walk_ifwdtsn(pos, chunk, end) \ #define _sctp_walk_ifwdtsn(pos, chunk, end) \
for (pos = chunk->subh.ifwdtsn_hdr->skip; \ for (pos = (void *)(chunk->subh.ifwdtsn_hdr + 1); \
(void *)pos <= (void *)chunk->subh.ifwdtsn_hdr->skip + (end) - \ (void *)pos <= (void *)(chunk->subh.ifwdtsn_hdr + 1) + (end) - \
sizeof(struct sctp_ifwdtsn_skip); pos++) sizeof(struct sctp_ifwdtsn_skip); pos++)
#define sctp_walk_ifwdtsn(pos, ch) \ #define sctp_walk_ifwdtsn(pos, ch) \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment