summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-02-20 13:16:27 +1100
committerStephen Rothwell <sfr@canb.auug.org.au>2013-02-26 13:41:54 +1100
commit4ecd12787d5c98bc25738e364093a0cc2632d728 (patch)
tree34eb8b253e36c66d58c6c24ae540b1e7b9f7f66e
parent3c5a0d1b9183f4d85848461fffda1a2f3a2f5907 (diff)
ipc-convert-to-idr_alloc-fix
v2: The v1 conversion of ipcget_public() was incorrect. As idr_pre_get() returns 0 for -ENOMEM failure, @err should have been initialized to 1 not 0. As the function doesn't do preloading itself anymore, there's no point in the error handling path. Simply remove the -ENOMEM path. Signed-off-by: Tejun Heo <tj@kernel.org> Reported-by: Sedat Dilek <sedat.dilek@gmail.com> Tested-by: Sedat Dilek <sedat.dilek@gmail.com> Cc: Stanislav Kinsbursky <skinsbursky@parallels.com> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: James Morris <jmorris@namei.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-rw-r--r--ipc/util.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/ipc/util.c b/ipc/util.c
index 91ce0bc621b5..464a8abd779f 100644
--- a/ipc/util.c
+++ b/ipc/util.c
@@ -370,7 +370,7 @@ static int ipcget_public(struct ipc_namespace *ns, struct ipc_ids *ids,
{
struct kern_ipc_perm *ipcp;
int flg = params->flg;
- int err = 0;
+ int err;
/*
* Take the lock as a writer since we are potentially going to add
@@ -382,8 +382,6 @@ static int ipcget_public(struct ipc_namespace *ns, struct ipc_ids *ids,
/* key not used */
if (!(flg & IPC_CREAT))
err = -ENOENT;
- else if (!err)
- err = -ENOMEM;
else
err = ops->getnew(ns, params);
} else {