All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vlad Yasevich <vladislav.yasevich@hp.com>
To: linux-sctp@vger.kernel.org
Subject: Re: [PATCH 2/4] sctp: remove dup code in net/sctp/socket.c
Date: Thu, 19 Feb 2009 13:47:46 +0000	[thread overview]
Message-ID: <499D6302.8090905@hp.com> (raw)
In-Reply-To: <499D250C.1030604@cn.fujitsu.com>

Wei Yongjun wrote:
> Remove dup check of "if (optlen < sizeof(int))".
> 
> Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
> ---
>  net/sctp/socket.c |    6 ------
>  1 files changed, 0 insertions(+), 6 deletions(-)
> 
> diff --git a/net/sctp/socket.c b/net/sctp/socket.c
> index dea864f..4bc558c 100644
> --- a/net/sctp/socket.c
> +++ b/net/sctp/socket.c
> @@ -3069,9 +3069,6 @@ static int sctp_setsockopt_maxburst(struct sock *sk,
>  	int val;
>  	int assoc_id = 0;
>  
> -	if (optlen < sizeof(int))
> -		return -EINVAL;
> -
>  	if (optlen = sizeof(int)) {
>  		printk(KERN_WARNING
>  		   "SCTP: Use of int in max_burst socket option deprecated\n");
> @@ -5283,9 +5280,6 @@ static int sctp_getsockopt_maxburst(struct sock *sk, int len,
>  	struct sctp_sock *sp;
>  	struct sctp_association *asoc;
>  
> -	if (len < sizeof(int))
> -		return -EINVAL;
> -
>  	if (len = sizeof(int)) {
>  		printk(KERN_WARNING
>  		   "SCTP: Use of int in max_burst socket option deprecated\n");

Ok, but there is another bug here.  The code in getsockopt_maxburst doesn't
allow len to be larger then sctp_assoc_params, which is a common case where
app writers just pass down the sizeof(buf) or something similar.

Thanks
-vlad

      reply	other threads:[~2009-02-19 13:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-19  9:23 [PATCH 2/4] sctp: remove dup code in net/sctp/socket.c Wei Yongjun
2009-02-19 13:47 ` Vlad Yasevich [this message]

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=499D6302.8090905@hp.com \
    --to=vladislav.yasevich@hp.com \
    --cc=linux-sctp@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.