lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <2547094.3YTvOEEdct@daeseok-laptop>
Date:	Wed, 27 Nov 2013 12:12:13 +0900
From:	Daeseok Youn <daeseok.youn@...il.com>
To:	akpm@...ux-foundation.org
Cc:	oleg@...hat.com, viro@...iv.linux.org.uk, ebiederm@...ssion.com,
	luto@...capital.net, linux-kernel@...r.kernel.org,
	kernel-janitors@...r.kernel.org
Subject: [PATCH] kernel/fork.c : remove local 'oldmm' and retval

>From cec2f201f0dc99a33a58d9d1e0452140bb0993a1 Mon Sep 17 00:00:00 2001
From: Daeseok Youn <daeseok.youn@....com>
Date: Wed, 27 Nov 2013 09:54:41 +0900
Subject: [PATCH] kernel/fork.c : remove local 'oldmm' and retval

 Local oldmm is used only for increaing mm_users field
 in current->mm. When clone_flags have a CLONE_VM flag,
 current->mm is assigning to local 'mm'.
 Local retval is used only for returning -ENOMEM value.
 When dup_mm() is failed, just return -ENOMEM.

 Signed-off-by: Daeseok Youn <daeseok.youn@...il.com>
---
 kernel/fork.c |   16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/kernel/fork.c b/kernel/fork.c
index 728d5be..022a0af 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -857,8 +857,7 @@ fail_nocontext:
 
 static int copy_mm(unsigned long clone_flags, struct task_struct *tsk)
 {
-	struct mm_struct *mm, *oldmm;
-	int retval;
+	struct mm_struct *mm;
 
 	tsk->min_flt = tsk->maj_flt = 0;
 	tsk->nvcsw = tsk->nivcsw = 0;
@@ -874,28 +873,23 @@ static int copy_mm(unsigned long clone_flags, struct task_struct *tsk)
 	 *
 	 * We need to steal a active VM for that..
 	 */
-	oldmm = current->mm;
-	if (!oldmm)
+	if (!current->mm)
 		return 0;
 
 	if (clone_flags & CLONE_VM) {
-		atomic_inc(&oldmm->mm_users);
-		mm = oldmm;
+		mm = current->mm;
+		atomic_inc(&mm->mm_users);
 		goto good_mm;
 	}
 
-	retval = -ENOMEM;
 	mm = dup_mm(tsk);
 	if (!mm)
-		goto fail_nomem;
+		return -ENOMEM;
 
 good_mm:
 	tsk->mm = mm;
 	tsk->active_mm = mm;
 	return 0;
-
-fail_nomem:
-	return retval;
 }
 
 static int copy_fs(unsigned long clone_flags, struct task_struct *tsk)
-- 
1.7.9.5

---
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ