aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Morton <akpm@linux-foundation.org>2015-06-05 15:03:52 +1000
committerMichael Ellerman <mpe@ellerman.id.au>2015-06-05 15:03:52 +1000
commitf3937d2cb2a36ca49d4dfd5d13dd683620185b1c (patch)
treed91f8e9a93d984665fdcaecb7d730e3256fa6764
parent41b3f2b51941d8cb3ef0670b4752844958ea2a8d (diff)
downloadlinux-next-f3937d2cb2a36ca49d4dfd5d13dd683620185b1c.tar.gz
ipcshm-move-bug_on-check-into-shm_lock-fix
simplify code Cc: Davidlohr Bueso <dave@stgolabs.net> Cc: Davidlohr Bueso <dbueso@suse.de> Cc: Manfred Spraul <manfred@colorfullife.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-rw-r--r--ipc/shm.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/ipc/shm.c b/ipc/shm.c
index 15a9ea0bd04199..763e6e3c37dc32 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -155,14 +155,11 @@ static inline struct shmid_kernel *shm_lock(struct ipc_namespace *ns, int id)
{
struct kern_ipc_perm *ipcp = ipc_lock(&shm_ids(ns), id);
- if (IS_ERR(ipcp)) {
- /*
- * We raced in the idr lookup or with RMID,
- * either way, the ID is busted.
- */
- BUG();
- return (struct shmid_kernel *)ipcp;
- }
+ /*
+ * We raced in the idr lookup or with RMID. Either way, the ID is
+ * busted.
+ */
+ BUG_ON(IS_ERR(ipcp));
return container_of(ipcp, struct shmid_kernel, shm_perm);
}