summaryrefslogtreecommitdiff
path: root/ipc/util.c
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2017-07-12 14:34:47 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2017-07-12 16:26:01 -0700
commitf8dbe8d290637ac3f68600e30d092393fe9b40a5 (patch)
tree20108014c81821082abd938b2c95f4d6a23655e3 /ipc/util.c
parent2cd648c110b5570c3280bd645797658cabbe5f5c (diff)
ipc: drop non-RCU allocation
The only users of ipc_alloc() were ipc_rcu_alloc() and the on-heap sem_io fall-back memory. Better to just open-code these to make things easier to read. [manfred@colorfullife.com: Rediff due to inclusion of memset() into ipc_rcu_alloc()] Link: http://lkml.kernel.org/r/20170525185107.12869-5-manfred@colorfullife.com Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Manfred Spraul <manfred@colorfullife.com> Cc: Davidlohr Bueso <dave@stgolabs.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'ipc/util.c')
-rw-r--r--ipc/util.c25
1 files changed, 1 insertions, 24 deletions
diff --git a/ipc/util.c b/ipc/util.c
index 5d1ff1035efe..dd73feb1569a 100644
--- a/ipc/util.c
+++ b/ipc/util.c
@@ -395,29 +395,6 @@ void ipc_rmid(struct ipc_ids *ids, struct kern_ipc_perm *ipcp)
}
/**
- * ipc_alloc - allocate ipc space
- * @size: size desired
- *
- * Allocate memory from the appropriate pools and return a pointer to it.
- * NULL is returned if the allocation fails
- */
-void *ipc_alloc(int size)
-{
- return kvmalloc(size, GFP_KERNEL);
-}
-
-/**
- * ipc_free - free ipc space
- * @ptr: pointer returned by ipc_alloc
- *
- * Free a block created with ipc_alloc().
- */
-void ipc_free(void *ptr)
-{
- kvfree(ptr);
-}
-
-/**
* ipc_rcu_alloc - allocate ipc space
* @size: size desired
*
@@ -429,7 +406,7 @@ struct kern_ipc_perm *ipc_rcu_alloc(int size)
/*
* We prepend the allocation with the rcu struct
*/
- struct kern_ipc_perm *out = ipc_alloc(size);
+ struct kern_ipc_perm *out = kvmalloc(size, GFP_KERNEL);
if (unlikely(!out))
return NULL;