futex: change signature of fetch_robust_entry()
PATCH 1/3 futex: change signature of fetch_robust_entry()
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.
--- kernel/futex.c | 2 +- kernel/futex_compat.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
kernel/futex.c +1 -1
@@ -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;
kernel/futex_compat.c +1 -1
@@ -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 ;
Signature · 1 line
1.7.2.2
PATCH 2/3 futex: mark restart_block.futex.uaddr as a __user pointer
@uaddr field in restart_block.futex is a user pointer but was missing __user markup. Add it and remove unnecessary castings.
--- include/linux/thread_info.h | 4 ++-- kernel/futex.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
include/linux/thread_info.h +2 -2
@@ -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 {
kernel/futex.c +2 -2
@@ -1843,7 +1843,7 @@ retry: restart = ¤t_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 ;
Signature · 1 line
1.7.2.2
[tip:core/futexes] futex: Mark restart_block.futex.uaddr[2] __user
Commit-ID: a3c74c52570c0c4ac90c9a0216de800c39089ba7 Gitweb: http://git.kernel.org/tip/a3c74c52570c0c4ac90c9a0216de800c39089ba7 Author: Namhyung Kim <[email protected]> AuthorDate: Tue, 14 Sep 2010 21:43:47 +0900 Committer: Thomas Gleixner <[email protected]> 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.
LKML-Reference: <[email protected]>
--- include/linux/thread_info.h | 4 ++-- kernel/futex.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
include/linux/thread_info.h +2 -2
@@ -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 {
kernel/futex.c +2 -2
@@ -1843,7 +1843,7 @@ retry: restart = ¤t_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 ;
PATCH 3/3 futex: add lock context annotations
In reply to Namhyung Kimqueue_lock/unlock/me() and unqueue_me_pi() grab/release spinlocks but were missing proper annotations. Add it.
--- kernel/futex.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
kernel/futex.c +4 -0
@@ -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);
Signature · 1 line
1.7.2.2
[tip:core/futexes] futex: Add lock context annotations
Commit-ID: 15e408cd6ccc3f4f453d87ccd5bc7a84d59feb96 Gitweb: http://git.kernel.org/tip/15e408cd6ccc3f4f453d87ccd5bc7a84d59feb96 Author: Namhyung Kim <[email protected]> AuthorDate: Tue, 14 Sep 2010 21:43:48 +0900 Committer: Thomas Gleixner <[email protected]> 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.
LKML-Reference: <[email protected]>
--- kernel/futex.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
kernel/futex.c +4 -0
@@ -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);
[tip:core/futexes] futex: Change 3rd arg of fetch_robust_entry() to unsigned int*
In reply to Namhyung KimCommit-ID: 1dcc41bb037533839753df983d31778b30b67d93 Gitweb: http://git.kernel.org/tip/1dcc41bb037533839753df983d31778b30b67d93 Author: Namhyung Kim <[email protected]> AuthorDate: Tue, 14 Sep 2010 21:43:46 +0900 Committer: Thomas Gleixner <[email protected]> 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'.
LKML-Reference: <[email protected]>
--- kernel/futex.c | 2 +- kernel/futex_compat.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
kernel/futex.c +1 -1
@@ -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;
kernel/futex_compat.c +1 -1
@@ -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 ;