From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1425058AbdEYSxE (ORCPT ); Thu, 25 May 2017 14:53:04 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:33474 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1036510AbdEYSvj (ORCPT ); Thu, 25 May 2017 14:51:39 -0400 From: Manfred Spraul To: mtk.manpages@gmail.com, Andrew Morton , Kees Cook Cc: LKML , 1vier1@web.de, Davidlohr Bueso , mingo@kernel.org, peterz@infradead.org, fabf@skynet.be, Manfred Spraul Subject: [PATCH 12/20] ipc/util: Drop ipc_rcu_alloc() Date: Thu, 25 May 2017 20:50:59 +0200 Message-Id: <20170525185107.12869-13-manfred@colorfullife.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170525185107.12869-1-manfred@colorfullife.com> References: <20170508222345.GA52073@beast> <20170525185107.12869-1-manfred@colorfullife.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kees Cook No callers remain for ipc_rcu_alloc(). Drop the function. Signed-off-by: Kees Cook [manfred@colorfullife.com: Rediff because the memset was temporarily inside ipc_rcu_free()] Signed-off-by: Manfred Spraul --- ipc/util.c | 21 --------------------- ipc/util.h | 3 --- 2 files changed, 24 deletions(-) diff --git a/ipc/util.c b/ipc/util.c index 556884b..2428dd4 100644 --- a/ipc/util.c +++ b/ipc/util.c @@ -394,27 +394,6 @@ void ipc_rmid(struct ipc_ids *ids, struct kern_ipc_perm *ipcp) ipcp->deleted = true; } -/** - * ipc_rcu_alloc - allocate ipc space - * @size: size desired - * - * Allocate memory for an ipc object. - * The first member must be struct kern_ipc_perm. - */ -struct kern_ipc_perm *ipc_rcu_alloc(int size) -{ - /* - * We prepend the allocation with the rcu struct - */ - struct kern_ipc_perm *out = kvmalloc(size, GFP_KERNEL); - if (unlikely(!out)) - return NULL; - - memset(out, 0, size); - atomic_set(&out->refcount, 1); - return out; -} - int ipc_rcu_getref(struct kern_ipc_perm *ptr) { return atomic_inc_not_zero(&ptr->refcount); diff --git a/ipc/util.h b/ipc/util.h index 44efbc0..77336c2b 100644 --- a/ipc/util.h +++ b/ipc/util.h @@ -112,10 +112,7 @@ int ipcperms(struct ipc_namespace *ns, struct kern_ipc_perm *ipcp, short flg); * Objects are reference counted, they start with reference count 1. * getref increases the refcount, the putref call that reduces the recount * to 0 schedules the rcu destruction. Caller must guarantee locking. - * - * struct kern_ipc_perm must be the first member in the allocated structure. */ -struct kern_ipc_perm *ipc_rcu_alloc(int size); int ipc_rcu_getref(struct kern_ipc_perm *ptr); void ipc_rcu_putref(struct kern_ipc_perm *ptr, void (*func)(struct rcu_head *head)); -- 2.9.3