mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/3] futex: change signature of fetch_robust_entry()
@ 2010-09-14 12:43 Namhyung Kim
  2010-09-14 12:43 ` [PATCH 2/3] futex: mark restart_block.futex.uaddr as a __user pointer Namhyung Kim
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Namhyung Kim @ 2010-09-14 12:43 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner; +Cc: Peter Zijlstra, Darren Hart, linux-kernel

Make 3rd argument of fetch_robust_entry() 'unsigned int' in order to
remove following warnings from sparse:

 kernel/futex.c:2495:59: warning: incorrect type in argument 3 (different signedness)
 kernel/futex.c:2495:59:    expected int *pi
 kernel/futex.c:2495:59:    got unsigned int *<noident>
 kernel/futex.c:2506:67: warning: incorrect type in argument 3 (different signedness)
 kernel/futex.c:2506:67:    expected int *pi
 kernel/futex.c:2506:67:    got unsigned int *<noident>
 kernel/futex.c:2515:69: warning: incorrect type in argument 3 (different signedness)
 kernel/futex.c:2515:69:    expected int *pi
 kernel/futex.c:2515:69:    got unsigned int *<noident>

Since all of its users were using 'unsigned int' already, it could
be changed safely.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
 kernel/futex.c        |    2 +-
 kernel/futex_compat.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/futex.c b/kernel/futex.c
index 6a3a5fa..464de27 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -2458,7 +2458,7 @@ retry:
  */
 static inline int fetch_robust_entry(struct robust_list __user **entry,
 				     struct robust_list __user * __user *head,
-				     int *pi)
+				     unsigned int *pi)
 {
 	unsigned long uentry;
 
diff --git a/kernel/futex_compat.c b/kernel/futex_compat.c
index d49afb2..06da4df 100644
--- a/kernel/futex_compat.c
+++ b/kernel/futex_compat.c
@@ -19,7 +19,7 @@
  */
 static inline int
 fetch_robust_entry(compat_uptr_t *uentry, struct robust_list __user **entry,
-		   compat_uptr_t __user *head, int *pi)
+		   compat_uptr_t __user *head, unsigned int *pi)
 {
 	if (get_user(*uentry, head))
 		return -EFAULT;
-- 
1.7.2.2


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

* [PATCH 2/3] futex: mark restart_block.futex.uaddr as a __user pointer
  2010-09-14 12:43 [PATCH 1/3] futex: change signature of fetch_robust_entry() Namhyung Kim
@ 2010-09-14 12:43 ` Namhyung Kim
  2010-09-18 10:22   ` [tip:core/futexes] futex: Mark restart_block.futex.uaddr[2] __user tip-bot for Namhyung Kim
  2010-09-14 12:43 ` [PATCH 3/3] futex: add lock context annotations Namhyung Kim
  2010-09-18 10:22 ` [tip:core/futexes] futex: Change 3rd arg of fetch_robust_entry() to unsigned int* tip-bot for Namhyung Kim
  2 siblings, 1 reply; 6+ messages in thread
From: Namhyung Kim @ 2010-09-14 12:43 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner; +Cc: Peter Zijlstra, Darren Hart, linux-kernel

@uaddr field in restart_block.futex is a user pointer but was
missing __user markup. Add it and remove unnecessary castings.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
 include/linux/thread_info.h |    4 ++--
 kernel/futex.c              |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
index a8cc4e1..c906965 100644
--- a/include/linux/thread_info.h
+++ b/include/linux/thread_info.h
@@ -23,12 +23,12 @@ struct restart_block {
 		};
 		/* For futex_wait and futex_wait_requeue_pi */
 		struct {
-			u32 *uaddr;
+			u32 __user *uaddr;
 			u32 val;
 			u32 flags;
 			u32 bitset;
 			u64 time;
-			u32 *uaddr2;
+			u32 __user *uaddr2;
 		} futex;
 		/* For nanosleep */
 		struct {
diff --git a/kernel/futex.c b/kernel/futex.c
index 464de27..45e448a 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -1843,7 +1843,7 @@ retry:
 
 	restart = &current_thread_info()->restart_block;
 	restart->fn = futex_wait_restart;
-	restart->futex.uaddr = (u32 *)uaddr;
+	restart->futex.uaddr = uaddr;
 	restart->futex.val = val;
 	restart->futex.time = abs_time->tv64;
 	restart->futex.bitset = bitset;
@@ -1869,7 +1869,7 @@ out:
 
 static long futex_wait_restart(struct restart_block *restart)
 {
-	u32 __user *uaddr = (u32 __user *)restart->futex.uaddr;
+	u32 __user *uaddr = restart->futex.uaddr;
 	int fshared = 0;
 	ktime_t t, *tp = NULL;
 
-- 
1.7.2.2


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

* [PATCH 3/3] futex: add lock context annotations
  2010-09-14 12:43 [PATCH 1/3] futex: change signature of fetch_robust_entry() Namhyung Kim
  2010-09-14 12:43 ` [PATCH 2/3] futex: mark restart_block.futex.uaddr as a __user pointer Namhyung Kim
@ 2010-09-14 12:43 ` Namhyung Kim
  2010-09-18 10:22   ` [tip:core/futexes] futex: Add " tip-bot for Namhyung Kim
  2010-09-18 10:22 ` [tip:core/futexes] futex: Change 3rd arg of fetch_robust_entry() to unsigned int* tip-bot for Namhyung Kim
  2 siblings, 1 reply; 6+ messages in thread
From: Namhyung Kim @ 2010-09-14 12:43 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner; +Cc: Peter Zijlstra, Darren Hart, linux-kernel

queue_lock/unlock/me() and unqueue_me_pi() grab/release spinlocks
but were missing proper annotations. Add it.

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

diff --git a/kernel/futex.c b/kernel/futex.c
index 45e448a..92a31d4 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -1360,6 +1360,7 @@ out:
 
 /* The key must be already stored in q->key. */
 static inline struct futex_hash_bucket *queue_lock(struct futex_q *q)
+	__acquires(&hb->lock)
 {
 	struct futex_hash_bucket *hb;
 
@@ -1373,6 +1374,7 @@ static inline struct futex_hash_bucket *queue_lock(struct futex_q *q)
 
 static inline void
 queue_unlock(struct futex_q *q, struct futex_hash_bucket *hb)
+	__releases(&hb->lock)
 {
 	spin_unlock(&hb->lock);
 	drop_futex_key_refs(&q->key);
@@ -1391,6 +1393,7 @@ queue_unlock(struct futex_q *q, struct futex_hash_bucket *hb)
  * an example).
  */
 static inline void queue_me(struct futex_q *q, struct futex_hash_bucket *hb)
+	__releases(&hb->lock)
 {
 	int prio;
 
@@ -1471,6 +1474,7 @@ retry:
  * and dropped here.
  */
 static void unqueue_me_pi(struct futex_q *q)
+	__releases(q->lock_ptr)
 {
 	WARN_ON(plist_node_empty(&q->list));
 	plist_del(&q->list, &q->list.plist);
-- 
1.7.2.2


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

* [tip:core/futexes] futex: Change 3rd arg of fetch_robust_entry() to unsigned int*
  2010-09-14 12:43 [PATCH 1/3] futex: change signature of fetch_robust_entry() Namhyung Kim
  2010-09-14 12:43 ` [PATCH 2/3] futex: mark restart_block.futex.uaddr as a __user pointer Namhyung Kim
  2010-09-14 12:43 ` [PATCH 3/3] futex: add lock context annotations Namhyung Kim
@ 2010-09-18 10:22 ` tip-bot for Namhyung Kim
  2 siblings, 0 replies; 6+ messages in thread
From: tip-bot for Namhyung Kim @ 2010-09-18 10:22 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, dvhltc, hpa, mingo, a.p.zijlstra, tglx, namhyung

Commit-ID:  1dcc41bb037533839753df983d31778b30b67d93
Gitweb:     http://git.kernel.org/tip/1dcc41bb037533839753df983d31778b30b67d93
Author:     Namhyung Kim <namhyung@gmail.com>
AuthorDate: Tue, 14 Sep 2010 21:43:46 +0900
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Sat, 18 Sep 2010 12:19:21 +0200

futex: Change 3rd arg of fetch_robust_entry() to unsigned int*

Sparse complains:
 kernel/futex.c:2495:59: warning: incorrect type in argument 3 (different signedness)

Make 3rd argument of fetch_robust_entry() 'unsigned int'.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Darren Hart <dvhltc@us.ibm.com>
LKML-Reference: <1284468228-8723-1-git-send-email-namhyung@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 kernel/futex.c        |    2 +-
 kernel/futex_compat.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/futex.c b/kernel/futex.c
index 6a3a5fa..464de27 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -2458,7 +2458,7 @@ retry:
  */
 static inline int fetch_robust_entry(struct robust_list __user **entry,
 				     struct robust_list __user * __user *head,
-				     int *pi)
+				     unsigned int *pi)
 {
 	unsigned long uentry;
 
diff --git a/kernel/futex_compat.c b/kernel/futex_compat.c
index d49afb2..06da4df 100644
--- a/kernel/futex_compat.c
+++ b/kernel/futex_compat.c
@@ -19,7 +19,7 @@
  */
 static inline int
 fetch_robust_entry(compat_uptr_t *uentry, struct robust_list __user **entry,
-		   compat_uptr_t __user *head, int *pi)
+		   compat_uptr_t __user *head, unsigned int *pi)
 {
 	if (get_user(*uentry, head))
 		return -EFAULT;

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

* [tip:core/futexes] futex: Mark restart_block.futex.uaddr[2] __user
  2010-09-14 12:43 ` [PATCH 2/3] futex: mark restart_block.futex.uaddr as a __user pointer Namhyung Kim
@ 2010-09-18 10:22   ` tip-bot for Namhyung Kim
  0 siblings, 0 replies; 6+ messages in thread
From: tip-bot for Namhyung Kim @ 2010-09-18 10:22 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, dvhltc, hpa, mingo, a.p.zijlstra, tglx, namhyung

Commit-ID:  a3c74c52570c0c4ac90c9a0216de800c39089ba7
Gitweb:     http://git.kernel.org/tip/a3c74c52570c0c4ac90c9a0216de800c39089ba7
Author:     Namhyung Kim <namhyung@gmail.com>
AuthorDate: Tue, 14 Sep 2010 21:43:47 +0900
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Sat, 18 Sep 2010 12:19:21 +0200

futex: Mark restart_block.futex.uaddr[2] __user

@uaddr and @uaddr2 fields in restart_block.futex are user
pointers. Add __user and remove unnecessary casts.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Darren Hart <dvhltc@us.ibm.com>
LKML-Reference: <1284468228-8723-2-git-send-email-namhyung@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 include/linux/thread_info.h |    4 ++--
 kernel/futex.c              |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
index a8cc4e1..c906965 100644
--- a/include/linux/thread_info.h
+++ b/include/linux/thread_info.h
@@ -23,12 +23,12 @@ struct restart_block {
 		};
 		/* For futex_wait and futex_wait_requeue_pi */
 		struct {
-			u32 *uaddr;
+			u32 __user *uaddr;
 			u32 val;
 			u32 flags;
 			u32 bitset;
 			u64 time;
-			u32 *uaddr2;
+			u32 __user *uaddr2;
 		} futex;
 		/* For nanosleep */
 		struct {
diff --git a/kernel/futex.c b/kernel/futex.c
index 464de27..45e448a 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -1843,7 +1843,7 @@ retry:
 
 	restart = &current_thread_info()->restart_block;
 	restart->fn = futex_wait_restart;
-	restart->futex.uaddr = (u32 *)uaddr;
+	restart->futex.uaddr = uaddr;
 	restart->futex.val = val;
 	restart->futex.time = abs_time->tv64;
 	restart->futex.bitset = bitset;
@@ -1869,7 +1869,7 @@ out:
 
 static long futex_wait_restart(struct restart_block *restart)
 {
-	u32 __user *uaddr = (u32 __user *)restart->futex.uaddr;
+	u32 __user *uaddr = restart->futex.uaddr;
 	int fshared = 0;
 	ktime_t t, *tp = NULL;
 

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

* [tip:core/futexes] futex: Add lock context annotations
  2010-09-14 12:43 ` [PATCH 3/3] futex: add lock context annotations Namhyung Kim
@ 2010-09-18 10:22   ` tip-bot for Namhyung Kim
  0 siblings, 0 replies; 6+ messages in thread
From: tip-bot for Namhyung Kim @ 2010-09-18 10:22 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, dvhltc, hpa, mingo, a.p.zijlstra, tglx, namhyung

Commit-ID:  15e408cd6ccc3f4f453d87ccd5bc7a84d59feb96
Gitweb:     http://git.kernel.org/tip/15e408cd6ccc3f4f453d87ccd5bc7a84d59feb96
Author:     Namhyung Kim <namhyung@gmail.com>
AuthorDate: Tue, 14 Sep 2010 21:43:48 +0900
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Sat, 18 Sep 2010 12:19:21 +0200

futex: Add lock context annotations

queue_lock/unlock/me() and unqueue_me_pi() grab/release spinlocks
but are missing proper annotations. Add them.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Darren Hart <dvhltc@us.ibm.com>
LKML-Reference: <1284468228-8723-3-git-send-email-namhyung@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 kernel/futex.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/kernel/futex.c b/kernel/futex.c
index 45e448a..92a31d4 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -1360,6 +1360,7 @@ out:
 
 /* The key must be already stored in q->key. */
 static inline struct futex_hash_bucket *queue_lock(struct futex_q *q)
+	__acquires(&hb->lock)
 {
 	struct futex_hash_bucket *hb;
 
@@ -1373,6 +1374,7 @@ static inline struct futex_hash_bucket *queue_lock(struct futex_q *q)
 
 static inline void
 queue_unlock(struct futex_q *q, struct futex_hash_bucket *hb)
+	__releases(&hb->lock)
 {
 	spin_unlock(&hb->lock);
 	drop_futex_key_refs(&q->key);
@@ -1391,6 +1393,7 @@ queue_unlock(struct futex_q *q, struct futex_hash_bucket *hb)
  * an example).
  */
 static inline void queue_me(struct futex_q *q, struct futex_hash_bucket *hb)
+	__releases(&hb->lock)
 {
 	int prio;
 
@@ -1471,6 +1474,7 @@ retry:
  * and dropped here.
  */
 static void unqueue_me_pi(struct futex_q *q)
+	__releases(q->lock_ptr)
 {
 	WARN_ON(plist_node_empty(&q->list));
 	plist_del(&q->list, &q->list.plist);

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

end of thread, other threads:[~2010-09-18 10:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-14 12:43 [PATCH 1/3] futex: change signature of fetch_robust_entry() Namhyung Kim
2010-09-14 12:43 ` [PATCH 2/3] futex: mark restart_block.futex.uaddr as a __user pointer Namhyung Kim
2010-09-18 10:22   ` [tip:core/futexes] futex: Mark restart_block.futex.uaddr[2] __user tip-bot for Namhyung Kim
2010-09-14 12:43 ` [PATCH 3/3] futex: add lock context annotations Namhyung Kim
2010-09-18 10:22   ` [tip:core/futexes] futex: Add " tip-bot for Namhyung Kim
2010-09-18 10:22 ` [tip:core/futexes] futex: Change 3rd arg of fetch_robust_entry() to unsigned int* tip-bot for Namhyung Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome