All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/4] sctp: remove dup code in net/sctp/socket.c
@ 2009-02-19  9:23 Wei Yongjun
  2009-02-19 13:47 ` Vlad Yasevich
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2009-02-19  9:23 UTC (permalink / raw)
  To: linux-sctp

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");
-- 
1.5.3.8





^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/4] sctp: remove dup code in net/sctp/socket.c
  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
  0 siblings, 0 replies; 2+ messages in thread
From: Vlad Yasevich @ 2009-02-19 13:47 UTC (permalink / raw)
  To: linux-sctp

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-02-19 13:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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.