Skip to contentSkip to conversation

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

PATCH In review Sukadev Bhattiprolu 2 participants 2 messages Aug 19, 2009 – Aug 25, 2009 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

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

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.

kernel/pid.c +3 -1
Index: linux-cr/kernel/pid.c
===================================================================
@@ -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--) {
#2 lore raw
In reply to a message not in the archive

Added, thanks.

Quoted 26 lines · Sukadev Bhattiprolu

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.

Index: linux-cr/kernel/pid.c
===================================================================

kernel/pid.c +3 -1
@@ -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--) {

_______________________________________________
Containers mailing list Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
https://lists.linux-foundation.org/mailman/listinfo/containers