Skip to contentSkip to conversation

fork: Using oldmm replace current->mm for dup_mm

PATCH New zhijun.han 1 participant 1 message Jul 30, 2024

Subsystems (3)
lore
Share & tools
lore

zhijun.han

author
#0 lore raw

PATCH 1/1 fork: Using oldmm replace current->mm for dup_mm

In the current implementation of copy_mm(),there is a line initializes oldmm = current->mm before dup_mm.
This means that there is no longer a need to use current->mm for dup_mm.

---
 kernel/fork.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/fork.c +1 -1
index 41771bde2ce7..833557bb0187 100644
@@ -1720,7 +1720,7 @@ static int copy_mm(unsigned long clone_flags, struct task_struct *tsk)
 		mmget(oldmm);
 		mm = oldmm;
 	} else {
-		mm = dup_mm(tsk, current->mm);
+		mm = dup_mm(tsk, oldmm);
 		if (!mm)
 			return -ENOMEM;
 	}
Signature · 1 line
2.45.2