Commit 2a9d6481 authored by Manfred Spraul's avatar Manfred Spraul Committed by Linus Torvalds

ipc/util.c: update return value of ipc_getref from int to bool

ipc_getref has still a return value of type "int", matching the atomic_t
interface of atomic_inc_not_zero()/atomic_add_unless().

ipc_getref now uses refcount_inc_not_zero, which has a return value of
type "bool".

Therefore, update the return code to avoid implicit conversions.

Link: http://lkml.kernel.org/r/20180712185241.4017-13-manfred@colorfullife.comSigned-off-by: default avatarManfred Spraul <manfred@colorfullife.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: Davidlohr Bueso <dbueso@suse.de>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Kees Cook <keescook@chromium.org>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Cc: Michal Hocko <mhocko@suse.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 27c331a1
...@@ -462,7 +462,7 @@ void ipc_set_key_private(struct ipc_ids *ids, struct kern_ipc_perm *ipcp) ...@@ -462,7 +462,7 @@ void ipc_set_key_private(struct ipc_ids *ids, struct kern_ipc_perm *ipcp)
ipcp->key = IPC_PRIVATE; ipcp->key = IPC_PRIVATE;
} }
int ipc_rcu_getref(struct kern_ipc_perm *ptr) bool ipc_rcu_getref(struct kern_ipc_perm *ptr)
{ {
return refcount_inc_not_zero(&ptr->refcount); return refcount_inc_not_zero(&ptr->refcount);
} }
......
...@@ -138,7 +138,7 @@ static inline int ipc_get_maxidx(struct ipc_ids *ids) ...@@ -138,7 +138,7 @@ static inline int ipc_get_maxidx(struct ipc_ids *ids)
* refcount is initialized by ipc_addid(), before that point call_rcu() * refcount is initialized by ipc_addid(), before that point call_rcu()
* must be used. * must be used.
*/ */
int ipc_rcu_getref(struct kern_ipc_perm *ptr); bool ipc_rcu_getref(struct kern_ipc_perm *ptr);
void ipc_rcu_putref(struct kern_ipc_perm *ptr, void ipc_rcu_putref(struct kern_ipc_perm *ptr,
void (*func)(struct rcu_head *head)); void (*func)(struct rcu_head *head));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment