[PATCH] c/r: alloc_pid() should return -ENOMEM on failure

Sukadev Bhattiprolu sukadev at linux.vnet.ibm.com
Wed Aug 19 12:46:54 PDT 2009


The clone_with_pids() patchset changed alloc_pid() to return an error
code in the pointer. alloc_pid() should then return -ENOMEM rather than
NULL when memory allocations fails.

Signed-off-by: Sukadev Bhattiprolu <sukadev at us.ibm.com>

Index: linux-cr/kernel/pid.c
===================================================================
--- linux-cr.orig/kernel/pid.c	2009-08-19 12:43:45.000000000 -0700
+++ linux-cr/kernel/pid.c	2009-08-19 12:45:33.000000000 -0700
@@ -290,8 +290,10 @@
 	int tpid;
 
 	pid = kmem_cache_alloc(ns->pid_cachep, GFP_KERNEL);
-	if (!pid)
+	if (!pid) {
+		pid = ERR_PTR(-ENOMEM);
 		goto out;
+	}
 
 	tmp = ns;
 	for (i = ns->level; i >= 0; i--) {


More information about the Containers mailing list