Commit 3aa623da authored by Xin Long's avatar Xin Long Committed by David S. Miller

sctp: use sizeof(__u16) for each stream number length instead of magic number

Now in stream reconf part there are still some places using magic
number 2 for each stream number length. To make it more readable,
this patch is to replace them with sizeof(__u16).
Reported-by: default avatarMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
Acked-by: default avatarMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 67c8d22a
...@@ -563,7 +563,7 @@ struct sctp_chunk *sctp_process_strreset_outreq( ...@@ -563,7 +563,7 @@ struct sctp_chunk *sctp_process_strreset_outreq(
flags = SCTP_STREAM_RESET_INCOMING_SSN; flags = SCTP_STREAM_RESET_INCOMING_SSN;
} }
nums = (ntohs(param.p->length) - sizeof(*outreq)) / 2; nums = (ntohs(param.p->length) - sizeof(*outreq)) / sizeof(__u16);
if (nums) { if (nums) {
str_p = outreq->list_of_streams; str_p = outreq->list_of_streams;
for (i = 0; i < nums; i++) { for (i = 0; i < nums; i++) {
...@@ -627,7 +627,7 @@ struct sctp_chunk *sctp_process_strreset_inreq( ...@@ -627,7 +627,7 @@ struct sctp_chunk *sctp_process_strreset_inreq(
goto out; goto out;
} }
nums = (ntohs(param.p->length) - sizeof(*inreq)) / 2; nums = (ntohs(param.p->length) - sizeof(*inreq)) / sizeof(__u16);
str_p = inreq->list_of_streams; str_p = inreq->list_of_streams;
for (i = 0; i < nums; i++) { for (i = 0; i < nums; i++) {
if (ntohs(str_p[i]) >= stream->outcnt) { if (ntohs(str_p[i]) >= stream->outcnt) {
...@@ -927,7 +927,8 @@ struct sctp_chunk *sctp_process_strreset_resp( ...@@ -927,7 +927,8 @@ struct sctp_chunk *sctp_process_strreset_resp(
outreq = (struct sctp_strreset_outreq *)req; outreq = (struct sctp_strreset_outreq *)req;
str_p = outreq->list_of_streams; str_p = outreq->list_of_streams;
nums = (ntohs(outreq->param_hdr.length) - sizeof(*outreq)) / 2; nums = (ntohs(outreq->param_hdr.length) - sizeof(*outreq)) /
sizeof(__u16);
if (result == SCTP_STRRESET_PERFORMED) { if (result == SCTP_STRRESET_PERFORMED) {
if (nums) { if (nums) {
...@@ -956,7 +957,8 @@ struct sctp_chunk *sctp_process_strreset_resp( ...@@ -956,7 +957,8 @@ struct sctp_chunk *sctp_process_strreset_resp(
inreq = (struct sctp_strreset_inreq *)req; inreq = (struct sctp_strreset_inreq *)req;
str_p = inreq->list_of_streams; str_p = inreq->list_of_streams;
nums = (ntohs(inreq->param_hdr.length) - sizeof(*inreq)) / 2; nums = (ntohs(inreq->param_hdr.length) - sizeof(*inreq)) /
sizeof(__u16);
*evp = sctp_ulpevent_make_stream_reset_event(asoc, flags, *evp = sctp_ulpevent_make_stream_reset_event(asoc, flags,
nums, str_p, GFP_ATOMIC); nums, str_p, GFP_ATOMIC);
......
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