All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] net/core: remove address space warnings on verify_iovec()
@ 2010-09-08 13:48 Namhyung Kim
  2010-09-08 13:48 ` [PATCH 2/2] net/core: add lock context change annotations in net/core/sock.c Namhyung Kim
  2010-09-09 22:02 ` [PATCH 1/2] net/core: remove address space warnings on verify_iovec() David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Namhyung Kim @ 2010-09-08 13:48 UTC (permalink / raw)
  To: David S. Miller, netdev; +Cc: linux-kernel

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(-)

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;
-- 
1.7.2.2


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

* [PATCH 2/2] net/core: add lock context change annotations in net/core/sock.c
  2010-09-08 13:48 [PATCH 1/2] net/core: remove address space warnings on verify_iovec() Namhyung Kim
@ 2010-09-08 13:48 ` Namhyung Kim
  2010-09-09 22:03   ` David Miller
  2010-09-09 22:02 ` [PATCH 1/2] net/core: remove address space warnings on verify_iovec() David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Namhyung Kim @ 2010-09-08 13:48 UTC (permalink / raw)
  To: David S. Miller, netdev; +Cc: linux-kernel

__lock_sock() and __release_sock() releases and regrabs lock but
were missing proper annotations. Add it. This removes following
warning from sparse. (Currently __lock_sock() does not emit any
warning about it but I think it is better to add also.)

 net/core/sock.c:1580:17: warning: context imbalance in '__release_sock' - unexpected unlock

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
 net/core/sock.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/net/core/sock.c b/net/core/sock.c
index b05b9b6..f3a06c4 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1557,6 +1557,8 @@ struct sk_buff *sock_alloc_send_skb(struct sock *sk, unsigned long size,
 EXPORT_SYMBOL(sock_alloc_send_skb);
 
 static void __lock_sock(struct sock *sk)
+	__releases(&sk->sk_lock.slock)
+	__acquires(&sk->sk_lock.slock)
 {
 	DEFINE_WAIT(wait);
 
@@ -1573,6 +1575,8 @@ static void __lock_sock(struct sock *sk)
 }
 
 static void __release_sock(struct sock *sk)
+	__releases(&sk->sk_lock.slock)
+	__acquires(&sk->sk_lock.slock)
 {
 	struct sk_buff *skb = sk->sk_backlog.head;
 
-- 
1.7.2.2


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

* Re: [PATCH 1/2] net/core: remove address space warnings on verify_iovec()
  2010-09-08 13:48 [PATCH 1/2] net/core: remove address space warnings on verify_iovec() Namhyung Kim
  2010-09-08 13:48 ` [PATCH 2/2] net/core: add lock context change annotations in net/core/sock.c Namhyung Kim
@ 2010-09-09 22:02 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2010-09-09 22:02 UTC (permalink / raw)
  To: namhyung; +Cc: netdev, linux-kernel

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.

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

* Re: [PATCH 2/2] net/core: add lock context change annotations in net/core/sock.c
  2010-09-08 13:48 ` [PATCH 2/2] net/core: add lock context change annotations in net/core/sock.c Namhyung Kim
@ 2010-09-09 22:03   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2010-09-09 22:03 UTC (permalink / raw)
  To: namhyung; +Cc: netdev, linux-kernel

From: Namhyung Kim <namhyung@gmail.com>
Date: Wed,  8 Sep 2010 22:48:48 +0900

> __lock_sock() and __release_sock() releases and regrabs lock but
> were missing proper annotations. Add it. This removes following
> warning from sparse. (Currently __lock_sock() does not emit any
> warning about it but I think it is better to add also.)
> 
>  net/core/sock.c:1580:17: warning: context imbalance in '__release_sock' - unexpected unlock
> 
> Signed-off-by: Namhyung Kim <namhyung@gmail.com>

Applied.

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

end of thread, other threads:[~2010-09-09 22:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-08 13:48 [PATCH 1/2] net/core: remove address space warnings on verify_iovec() Namhyung Kim
2010-09-08 13:48 ` [PATCH 2/2] net/core: add lock context change annotations in net/core/sock.c Namhyung Kim
2010-09-09 22:03   ` David Miller
2010-09-09 22:02 ` [PATCH 1/2] net/core: remove address space warnings on verify_iovec() 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.