Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1650743

[PATCH 19/20] ipc/sem: Drop __sem_free()

From Manfred Spraul <manfred@colorfullife.com>
Newsgroups linux.kernel
Subject [PATCH 19/20] ipc/sem: Drop __sem_free()
Date 2017-05-25 21:00 +0200
Message-ID <tL69l-3pt-27@gated-at.bofh.it> (permalink)
References <tEZke-1sP-3@gated-at.bofh.it> <tL69k-3pt-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Kees Cook <keescook@chromium.org>

The remaining users of __sem_free() can simply call kvfree() instead for
better readability.

Signed-off-by: Kees Cook <keescook@chromium.org>

[manfred@colorfullife.com: Rediff to keep rcu protection for
security_sem_alloc()]
Signed-off-by: Manfred Spraul <manfred@colorfullife.com>
---
 ipc/sem.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/ipc/sem.c b/ipc/sem.c
index 5f13773..9e70cd7 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -258,18 +258,13 @@ static void merge_queues(struct sem_array *sma)
 	}
 }
 
-static void __sem_free(struct sem_array *sma)
-{
-	kvfree(sma);
-}
-
 static void sem_rcu_free(struct rcu_head *head)
 {
 	struct kern_ipc_perm *p = container_of(head, struct kern_ipc_perm, rcu);
 	struct sem_array *sma = container_of(p, struct sem_array, sem_perm);
 
 	security_sem_free(sma);
-	__sem_free(sma);
+	kvfree(sma);
 }
 
 /*
@@ -500,7 +495,7 @@ static int newary(struct ipc_namespace *ns, struct ipc_params *params)
 	sma->sem_perm.security = NULL;
 	retval = security_sem_alloc(sma);
 	if (retval) {
-		__sem_free(sma);
+		kvfree(sma);
 		return retval;
 	}
 
-- 
2.9.3

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/20 V3] Misc cleanups for ipc Manfred Spraul <manfred@colorfullife.com> - 2017-05-25 21:00 +0200
  [PATCH 05/20] ipc/sem: Do not use ipc_rcu_free() Manfred Spraul <manfred@colorfullife.com> - 2017-05-25 21:00 +0200
  [PATCH 08/20] ipc/util: Drop ipc_rcu_free() Manfred Spraul <manfred@colorfullife.com> - 2017-05-25 21:00 +0200
  [PATCH 15/20] ipc/msg.c: Avoid ipc_rcu_putref for failed ipc_addid() Manfred Spraul <manfred@colorfullife.com> - 2017-05-25 21:00 +0200
  [PATCH 19/20] ipc/sem: Drop __sem_free() Manfred Spraul <manfred@colorfullife.com> - 2017-05-25 21:00 +0200
  [PATCH 20/20] ipc/util.h: Update documentation for ipc_getref() and ipc_putref() Manfred Spraul <manfred@colorfullife.com> - 2017-05-25 21:00 +0200
  [PATCH 09/20] ipc/sem: Avoid ipc_rcu_alloc() Manfred Spraul <manfred@colorfullife.com> - 2017-05-25 21:00 +0200
  [PATCH 17/20] ipc/shm: Remove special shm_alloc/free Manfred Spraul <manfred@colorfullife.com> - 2017-05-25 21:00 +0200
  [PATCH 11/20] ipc/msg: Avoid ipc_rcu_alloc() Manfred Spraul <manfred@colorfullife.com> - 2017-05-25 21:00 +0200
  [PATCH 12/20] ipc/util: Drop ipc_rcu_alloc() Manfred Spraul <manfred@colorfullife.com> - 2017-05-25 21:00 +0200
  [PATCH 16/20] ipc: Move atomic_set() to where it is needed Manfred Spraul <manfred@colorfullife.com> - 2017-05-25 21:00 +0200
  [PATCH 04/20] ipc: Drop non-RCU allocation Manfred Spraul <manfred@colorfullife.com> - 2017-05-25 21:00 +0200
    Re: [PATCH 04/20] ipc: Drop non-RCU allocation Kees Cook <keescook@chromium.org> - 2017-05-25 21:40 +0200
  [PATCH 03/20] include/linux/sem.h: Correctly document sem_ctime Manfred Spraul <manfred@colorfullife.com> - 2017-05-25 21:00 +0200
  [PATCH 07/20] ipc/msg: Do not use ipc_rcu_free() Manfred Spraul <manfred@colorfullife.com> - 2017-05-25 21:00 +0200
  [PATCH 10/20] ipc/shm: Avoid ipc_rcu_alloc() Manfred Spraul <manfred@colorfullife.com> - 2017-05-25 21:00 +0200
  Re: [PATCH 0/20 V3] Misc cleanups for ipc Kees Cook <keescook@chromium.org> - 2017-05-25 21:50 +0200
    Re: [PATCH 0/20 V3] Misc cleanups for ipc Manfred Spraul <manfred@colorfullife.com> - 2017-05-26 04:00 +0200

csiph-web