From: Marcelo Ricardo Leitner <marcelo.leitner@gmail•com>
To: Xin Long <lucien.xin@gmail•com>
Cc: network dev <netdev@vger•kernel.org>,
linux-sctp@vger•kernel.org, davem@davemloft•net,
Neil Horman <nhorman@tuxdriver•com>
Subject: Re: [PATCH net 1/5] sctp: use sizeof(__u16) for each stream number length instead of magic number
Date: Mon, 27 Nov 2017 11:36:26 -0200 [thread overview]
Message-ID: <20171127133626.GH3473@localhost.localdomain> (raw)
In-Reply-To: <feb3ee6070cc0f526210fa36752148c0e0704bcf.1511614961.git.lucien.xin@gmail.com>
On Sat, Nov 25, 2017 at 09:05:32PM +0800, Xin Long wrote:
> 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: Marcelo Ricardo Leitner <marcelo.leitner@gmail•com>
> Signed-off-by: Xin Long <lucien.xin@gmail•com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail•com>
> ---
> net/sctp/stream.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/net/sctp/stream.c b/net/sctp/stream.c
> index a11db21..09c797a 100644
> --- a/net/sctp/stream.c
> +++ b/net/sctp/stream.c
> @@ -563,7 +563,7 @@ struct sctp_chunk *sctp_process_strreset_outreq(
> 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) {
> str_p = outreq->list_of_streams;
> for (i = 0; i < nums; i++) {
> @@ -627,7 +627,7 @@ struct sctp_chunk *sctp_process_strreset_inreq(
> 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;
> for (i = 0; i < nums; i++) {
> if (ntohs(str_p[i]) >= stream->outcnt) {
> @@ -927,7 +927,8 @@ struct sctp_chunk *sctp_process_strreset_resp(
>
> outreq = (struct sctp_strreset_outreq *)req;
> 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 (nums) {
> @@ -956,7 +957,8 @@ struct sctp_chunk *sctp_process_strreset_resp(
>
> inreq = (struct sctp_strreset_inreq *)req;
> 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,
> nums, str_p, GFP_ATOMIC);
> --
> 2.1.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger•kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2017-11-27 13:36 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-25 13:05 [PATCH net 0/5] sctp: a bunch of fixes for stream reconfig Xin Long
2017-11-25 13:05 ` [PATCH net 1/5] sctp: use sizeof(__u16) for each stream number length instead of magic number Xin Long
2017-11-27 13:36 ` Marcelo Ricardo Leitner [this message]
2017-11-25 13:05 ` [PATCH net 2/5] sctp: only allow the out stream reset when the stream outq is empty Xin Long
2017-11-27 13:36 ` Marcelo Ricardo Leitner
2017-11-25 13:05 ` [PATCH net 3/5] sctp: only allow the asoc reset when the asoc " Xin Long
2017-11-27 10:06 ` David Laight
2017-11-27 10:58 ` Xin Long
2017-11-27 13:36 ` Marcelo Ricardo Leitner
2017-11-25 13:05 ` [PATCH net 4/5] sctp: avoid flushing unsent queue when doing asoc reset Xin Long
2017-11-27 13:37 ` Marcelo Ricardo Leitner
2017-11-25 13:05 ` [PATCH net 5/5] sctp: set sender next_tsn for the old result with ctsn_ack_point plus 1 Xin Long
2017-11-27 13:37 ` Marcelo Ricardo Leitner
2017-11-27 13:56 ` [PATCH net 0/5] sctp: a bunch of fixes for stream reconfig Neil Horman
2017-11-27 15:43 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171127133626.GH3473@localhost.localdomain \
--to=marcelo.leitner@gmail$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=linux-sctp@vger$(echo .)kernel.org \
--cc=lucien.xin@gmail$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=nhorman@tuxdriver$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox