Skip to content

Commit 978aa04

Browse files
lxindavem330
authored andcommitted
sctp: fix some type cast warnings introduced since very beginning
These warnings were found by running 'make C=2 M=net/sctp/'. They are there since very beginning. Note after this patch, there still one warning left in sctp_outq_flush(): sctp_chunk_fail(chunk, SCTP_ERROR_INV_STRM) Since it has been moved to sctp_stream_outq_migrate on net-next, to avoid the extra job when merging net-next to net, I will post the fix for it after the merging is done. Reported-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent f6fc6bc commit 978aa04

5 files changed

Lines changed: 7 additions & 7 deletions

File tree

include/linux/sctp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ struct sctp_datahdr {
231231
__be32 tsn;
232232
__be16 stream;
233233
__be16 ssn;
234-
__be32 ppid;
234+
__u32 ppid;
235235
__u8 payload[0];
236236
};
237237

include/uapi/linux/sctp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ struct sctp_remote_error {
376376
__u16 sre_type;
377377
__u16 sre_flags;
378378
__u32 sre_length;
379-
__u16 sre_error;
379+
__be16 sre_error;
380380
sctp_assoc_t sre_assoc_id;
381381
__u8 sre_data[0];
382382
};

net/sctp/ipv6.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ static int sctp_v6_skb_iif(const struct sk_buff *skb)
738738
/* Was this packet marked by Explicit Congestion Notification? */
739739
static int sctp_v6_is_ce(const struct sk_buff *skb)
740740
{
741-
return *((__u32 *)(ipv6_hdr(skb))) & htonl(1 << 20);
741+
return *((__u32 *)(ipv6_hdr(skb))) & (__force __u32)htonl(1 << 20);
742742
}
743743

744744
/* Dump the v6 addr to the seq file. */

net/sctp/sm_make_chunk.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2854,7 +2854,7 @@ struct sctp_chunk *sctp_make_asconf_update_ip(struct sctp_association *asoc,
28542854
addr_param_len = af->to_addr_param(addr, &addr_param);
28552855
param.param_hdr.type = flags;
28562856
param.param_hdr.length = htons(paramlen + addr_param_len);
2857-
param.crr_id = i;
2857+
param.crr_id = htonl(i);
28582858

28592859
sctp_addto_chunk(retval, paramlen, &param);
28602860
sctp_addto_chunk(retval, addr_param_len, &addr_param);
@@ -2867,7 +2867,7 @@ struct sctp_chunk *sctp_make_asconf_update_ip(struct sctp_association *asoc,
28672867
addr_param_len = af->to_addr_param(addr, &addr_param);
28682868
param.param_hdr.type = SCTP_PARAM_DEL_IP;
28692869
param.param_hdr.length = htons(paramlen + addr_param_len);
2870-
param.crr_id = i;
2870+
param.crr_id = htonl(i);
28712871

28722872
sctp_addto_chunk(retval, paramlen, &param);
28732873
sctp_addto_chunk(retval, addr_param_len, &addr_param);

net/sctp/sm_sideeffect.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1607,12 +1607,12 @@ static int sctp_cmd_interpreter(enum sctp_event event_type,
16071607
break;
16081608

16091609
case SCTP_CMD_INIT_FAILED:
1610-
sctp_cmd_init_failed(commands, asoc, cmd->obj.err);
1610+
sctp_cmd_init_failed(commands, asoc, cmd->obj.u32);
16111611
break;
16121612

16131613
case SCTP_CMD_ASSOC_FAILED:
16141614
sctp_cmd_assoc_failed(commands, asoc, event_type,
1615-
subtype, chunk, cmd->obj.err);
1615+
subtype, chunk, cmd->obj.u32);
16161616
break;
16171617

16181618
case SCTP_CMD_INIT_COUNTER_INC:

0 commit comments

Comments
 (0)