[PATCH] init: mark __user address space on string literals

Previous thread: [RFC] Docbook: allow warning on unused documentation by Johannes Berg on Wednesday, August 18, 2010 - 6:09 am. (7 messages)

Next thread: [PATCH] mmc: make dev_to_mmc_card() macro public by Andy Shevchenko on Wednesday, August 18, 2010 - 6:31 am. (8 messages)
From: Namhyung Kim
Date: Wednesday, August 18, 2010 - 6:24 am

When calling syscall service routines in kernel, some of arguments should be
user pointers but were missing __user markup on string literals. Add it.

Impact: remove sparse warnings

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
 init/do_mounts.c    |    4 ++--
 init/do_mounts_md.c |    2 +-
 init/do_mounts_rd.c |    4 ++--
 init/initramfs.c    |    5 +++--
 init/noinitramfs.c  |    6 +++---
 5 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/init/do_mounts.c b/init/do_mounts.c
index 8eabff6..91fc443 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -235,7 +235,7 @@ static int __init do_mount_root(char *name, char *fs, int flags, void *data)
 	if (err)
 		return err;
 
-	sys_chdir("/root");
+	sys_chdir((const char __user __force *)"/root");
 	ROOT_DEV = current->fs->pwd.mnt->mnt_sb->s_dev;
 	printk("VFS: Mounted root (%s filesystem)%s on device %u:%u.\n",
 	       current->fs->pwd.mnt->mnt_sb->s_type->name,
@@ -432,5 +432,5 @@ void __init prepare_namespace(void)
 out:
 	devtmpfs_mount("dev");
 	do_mount(".", "/", NULL, MS_MOVE, NULL);
-	sys_chroot(".");
+	sys_chroot((const char __user __force *)".");
 }
diff --git a/init/do_mounts_md.c b/init/do_mounts_md.c
index 69aebbf..32c4799 100644
--- a/init/do_mounts_md.c
+++ b/init/do_mounts_md.c
@@ -283,7 +283,7 @@ static void __init autodetect_raid(void)
 
 	wait_for_device_probe();
 
-	fd = sys_open("/dev/md0", 0, 0);
+	fd = sys_open((const char __user __force *) "/dev/md0", 0, 0);
 	if (fd >= 0) {
 		sys_ioctl(fd, RAID_AUTORUN, raid_autopart);
 		sys_close(fd);
diff --git a/init/do_mounts_rd.c b/init/do_mounts_rd.c
index bf3ef66..6e1ee69 100644
--- a/init/do_mounts_rd.c
+++ b/init/do_mounts_rd.c
@@ -168,7 +168,7 @@ int __init rd_load_image(char *from)
 	char rotator[4] = { '|' , '/' , '-' , '\\' };
 #endif
 
-	out_fd = sys_open("/dev/ram", O_RDWR, 0);
+	out_fd = sys_open((const char __user __force *) "/dev/ram", O_RDWR, 0);
 	if (out_fd < 0)
 		goto out;
 
@@ -267,7 +267,7 @@ ...
Previous thread: [RFC] Docbook: allow warning on unused documentation by Johannes Berg on Wednesday, August 18, 2010 - 6:09 am. (7 messages)

Next thread: [PATCH] mmc: make dev_to_mmc_card() macro public by Andy Shevchenko on Wednesday, August 18, 2010 - 6:31 am. (8 messages)