All of lore.kernel.org
 help / color / mirror / Atom feed
* [Patch net-next] kcm: remove a useless copy_from_user()
@ 2017-04-13 18:38 Cong Wang
  2017-04-17 17:28 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Cong Wang @ 2017-04-13 18:38 UTC (permalink / raw)
  To: netdev; +Cc: Cong Wang, Tom Herbert

struct kcm_clone only contains fd, and kcm_clone() only
writes this struct, so there is no need to copy it from user.

Cc: Tom Herbert <tom@herbertland.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
 net/kcm/kcmsock.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c
index 31762f7..deca20f 100644
--- a/net/kcm/kcmsock.c
+++ b/net/kcm/kcmsock.c
@@ -1707,11 +1707,7 @@ static int kcm_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
 		struct kcm_clone info;
 		struct socket *newsock = NULL;
 
-		if (copy_from_user(&info, (void __user *)arg, sizeof(info)))
-			return -EFAULT;
-
 		err = kcm_clone(sock, &info, &newsock);
-
 		if (!err) {
 			if (copy_to_user((void __user *)arg, &info,
 					 sizeof(info))) {
-- 
2.5.5

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

* Re: [Patch net-next] kcm: remove a useless copy_from_user()
  2017-04-13 18:38 [Patch net-next] kcm: remove a useless copy_from_user() Cong Wang
@ 2017-04-17 17:28 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-04-17 17:28 UTC (permalink / raw)
  To: xiyou.wangcong; +Cc: netdev, tom

From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Thu, 13 Apr 2017 11:38:02 -0700

> struct kcm_clone only contains fd, and kcm_clone() only
> writes this struct, so there is no need to copy it from user.
> 
> Cc: Tom Herbert <tom@herbertland.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>

Applied.

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

end of thread, other threads:[~2017-04-17 17:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-13 18:38 [Patch net-next] kcm: remove a useless copy_from_user() Cong Wang
2017-04-17 17:28 ` David Miller

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.