Skip to contentSkip to conversation

sunrpc: auth_gss: misused copy_to_user() return value

PATCH Superseded Kulikov Vasiliy 2 participants 2 messages Jul 30, 2010

Subsystems (5)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 9/9 sunrpc: auth_gss: misused copy_to_user() return value

copy_to_user() returns nonzero value on error, this value may be any value between 0 and requested count, not only requested count.

---
 net/sunrpc/auth_gss/auth_gss.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
net/sunrpc/auth_gss/auth_gss.c +1 -1
index 8da2a0e..232d7dc 100644
@@ -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;
 	}
Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 13 lines · Kulikov Vasiliy

copy_to_user() returns nonzero value on error, this value may be any value between 0 and requested count, not only requested count.

---
 net/sunrpc/auth_gss/auth_gss.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
net/sunrpc/auth_gss/auth_gss.c +0 -0
index 8da2a0e..232d7dc 100644

net/sunrpc/auth_gss/auth_gss.c gss_pipe_upcall(struct file *filp, struct rpc_pipe_msg *msg, · line 616

Quoted 8 lines
net/sunrpc/auth_gss/auth_gss.c +1 -1
@@ -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