Skip to content

Commit d4440aa

Browse files
author
Dominik Brodowski
committed
initrd: use do_mount() instead of ksys_mount()
All three calls to ksys_mount() in initrd-related kernel code can be switched over to do_mount(): - the first and third arguments are const strings in the kernel, and do not need to be copied over from userspace; - the fifth argument is NULL, and therefore no page needs to be, copied over from userspace; - the second and fourth argument are passed through anyway. Signed-off-by: Dominik Brodowski <[email protected]>
1 parent 5e787db commit d4440aa

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

init/do_mounts_initrd.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static int init_linuxrc(struct subprocess_info *info, struct cred *new)
5454
ksys_dup(0);
5555
/* move initrd over / and chdir/chroot in initrd root */
5656
ksys_chdir("/root");
57-
ksys_mount(".", "/", NULL, MS_MOVE, NULL);
57+
do_mount(".", "/", NULL, MS_MOVE, NULL);
5858
ksys_chroot(".");
5959
ksys_setsid();
6060
return 0;
@@ -89,7 +89,7 @@ static void __init handle_initrd(void)
8989
current->flags &= ~PF_FREEZER_SKIP;
9090

9191
/* move initrd to rootfs' /old */
92-
ksys_mount("..", ".", NULL, MS_MOVE, NULL);
92+
do_mount("..", ".", NULL, MS_MOVE, NULL);
9393
/* switch root and cwd back to / of rootfs */
9494
ksys_chroot("..");
9595

@@ -103,7 +103,7 @@ static void __init handle_initrd(void)
103103
mount_root();
104104

105105
printk(KERN_NOTICE "Trying to move old root to /initrd ... ");
106-
error = ksys_mount("/old", "/root/initrd", NULL, MS_MOVE, NULL);
106+
error = do_mount("/old", "/root/initrd", NULL, MS_MOVE, NULL);
107107
if (!error)
108108
printk("okay\n");
109109
else {

0 commit comments

Comments
 (0)