diff mbox

[9/9] sunrpc: auth_gss: misused copy_to_user() return value

Message ID 1280488234-21223-1-git-send-email-segooon@gmail.com
State Not Applicable, archived
Delegated to: David Miller
Headers show

Commit Message

Kulikov Vasiliy July 30, 2010, 11:10 a.m. UTC
copy_to_user() returns nonzero value on error, this value may be any
value between 0 and requested count, not only requested count.

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
---
 net/sunrpc/auth_gss/auth_gss.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Trond Myklebust July 30, 2010, 5:48 p.m. UTC | #1
On Fri, 2010-07-30 at 15:10 +0400, Kulikov Vasiliy wrote:
> copy_to_user() returns nonzero value on error, this value may be any
> value between 0 and requested count, not only requested count.
> 
> Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
> ---
>  net/sunrpc/auth_gss/auth_gss.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
> index 8da2a0e..232d7dc 100644
> --- a/net/sunrpc/auth_gss/auth_gss.c
> +++ b/net/sunrpc/auth_gss/auth_gss.c
> @@ -610,7 +610,7 @@ gss_pipe_upcall(struct file *filp, struct rpc_pipe_msg *msg,
>  	unsigned long left;
>  
>  	left = copy_to_user(dst, data, mlen);
> -	if (left == mlen) {
> +	if (left)
>  		msg->errno = -EFAULT;
>  		return -EFAULT;
>  	}

Ditto unnecessary...

Trond
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
index 8da2a0e..232d7dc 100644
--- a/net/sunrpc/auth_gss/auth_gss.c
+++ b/net/sunrpc/auth_gss/auth_gss.c
@@ -610,7 +610,7 @@  gss_pipe_upcall(struct file *filp, struct rpc_pipe_msg *msg,
 	unsigned long left;
 
 	left = copy_to_user(dst, data, mlen);
-	if (left == mlen) {
+	if (left)
 		msg->errno = -EFAULT;
 		return -EFAULT;
 	}