Patchwork [1/2] net/core: remove address space warnings on verify_iovec()

login
register
mail settings
Submitter Namhyung Kim
Date Sept. 8, 2010, 1:48 p.m.
Message ID <1283953728-15302-1-git-send-email-namhyung@gmail.com>
Download mbox | patch
Permalink /patch/64132/
State Accepted
Delegated to: David Miller
Headers show

Comments

Namhyung Kim - Sept. 8, 2010, 1:48 p.m.
move_addr_to_kernel() and copy_from_user() requires their argument
as __user pointer but were missing proper markups. Add it.
This removes following warnings from sparse.

 net/core/iovec.c:44:52: warning: incorrect type in argument 1 (different address spaces)
 net/core/iovec.c:44:52:    expected void [noderef] <asn:1>*uaddr
 net/core/iovec.c:44:52:    got void *msg_name
 net/core/iovec.c:55:34: warning: incorrect type in argument 2 (different address spaces)
 net/core/iovec.c:55:34:    expected void const [noderef] <asn:1>*from
 net/core/iovec.c:55:34:    got struct iovec *msg_iov

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
 net/core/iovec.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
David Miller - Sept. 9, 2010, 10:02 p.m.
From: Namhyung Kim <namhyung@gmail.com>
Date: Wed,  8 Sep 2010 22:48:47 +0900

> move_addr_to_kernel() and copy_from_user() requires their argument
> as __user pointer but were missing proper markups. Add it.
> This removes following warnings from sparse.
> 
>  net/core/iovec.c:44:52: warning: incorrect type in argument 1 (different address spaces)
>  net/core/iovec.c:44:52:    expected void [noderef] <asn:1>*uaddr
>  net/core/iovec.c:44:52:    got void *msg_name
>  net/core/iovec.c:55:34: warning: incorrect type in argument 2 (different address spaces)
>  net/core/iovec.c:55:34:    expected void const [noderef] <asn:1>*from
>  net/core/iovec.c:55:34:    got struct iovec *msg_iov
> 
> Signed-off-by: Namhyung Kim <namhyung@gmail.com>

Applied.
--
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

Patch

diff --git a/net/core/iovec.c b/net/core/iovec.c
index 1cd98df..f4657c2 100644
--- a/net/core/iovec.c
+++ b/net/core/iovec.c
@@ -41,7 +41,9 @@  int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr *address,
 
 	if (m->msg_namelen) {
 		if (mode == VERIFY_READ) {
-			err = move_addr_to_kernel(m->msg_name, m->msg_namelen,
+			void __user *namep;
+			namep = (void __user __force *) m->msg_name;
+			err = move_addr_to_kernel(namep, m->msg_namelen,
 						  address);
 			if (err < 0)
 				return err;
@@ -52,7 +54,7 @@  int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr *address,
 	}
 
 	size = m->msg_iovlen * sizeof(struct iovec);
-	if (copy_from_user(iov, m->msg_iov, size))
+	if (copy_from_user(iov, (void __user __force *) m->msg_iov, size))
 		return -EFAULT;
 
 	m->msg_iov = iov;