Skip to contentSkip to conversation

unshare: remove dead code

PATCH New Alan Cox 1 participant 1 message Oct 25, 2012

Subsystems (3)
lore
Share & tools
lore

Alan Cox

author
#0 lore raw

PATCH 1/1 unshare: remove dead code

From: Alan Cox <[email protected]>

If new_nsproxy is set we will always call switch_task_namespaces and then set new_nsproxy back to NULL so the reassignment and fall through check are redundant

---

 kernel/fork.c |    7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
kernel/fork.c +1 -6
index acc4cb6..60854b2 100644
@@ -1792,10 +1792,8 @@ SYSCALL_DEFINE1(unshare, unsigned long, unshare_flags)
 			exit_sem(current);
 		}
 
-		if (new_nsproxy) {
+		if (new_nsproxy)
 			switch_task_namespaces(current, new_nsproxy);
-			new_nsproxy = NULL;
-		}
 
 		task_lock(current);
 
@@ -1819,9 +1817,6 @@ SYSCALL_DEFINE1(unshare, unsigned long, unshare_flags)
 		task_unlock(current);
 	}
 
-	if (new_nsproxy)
-		put_nsproxy(new_nsproxy);
-
 bad_unshare_cleanup_fd:
 	if (new_fd)
 		put_files_struct(new_fd);