aboutsummaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@gmail.com>2010-10-26 17:22:42 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-26 19:52:15 -0400
commit562f5e638de4ef451226552fe8dd7847bacea24e (patch)
tree69a0ac78c9eca823a297c4b8e0810a5b1d4e3ee8 /init
parentf0cfec11180973e4f4b2b6909623e47eaaf7ecfe (diff)
init: mark __user address space on string literals
When calling syscall service routines in kernel, some of arguments should be user pointers but were missing __user markup on string literals. Add it. Removes some sparse warnings. Signed-off-by: Namhyung Kim <namhyung@gmail.com> Cc: Phillip Lougher <phillip@lougher.demon.co.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'init')
-rw-r--r--init/do_mounts.c4
-rw-r--r--init/do_mounts_md.c2
-rw-r--r--init/do_mounts_rd.c4
-rw-r--r--init/initramfs.c5
-rw-r--r--init/noinitramfs.c6
5 files changed, 11 insertions, 10 deletions
diff --git a/init/do_mounts.c b/init/do_mounts.c
index 62a47eafa8e9..830aaec9c7d5 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -291,7 +291,7 @@ static int __init do_mount_root(char *name, char *fs, int flags, void *data)
291 if (err) 291 if (err)
292 return err; 292 return err;
293 293
294 sys_chdir("/root"); 294 sys_chdir((const char __user __force *)"/root");
295 ROOT_DEV = current->fs->pwd.mnt->mnt_sb->s_dev; 295 ROOT_DEV = current->fs->pwd.mnt->mnt_sb->s_dev;
296 printk("VFS: Mounted root (%s filesystem)%s on device %u:%u.\n", 296 printk("VFS: Mounted root (%s filesystem)%s on device %u:%u.\n",
297 current->fs->pwd.mnt->mnt_sb->s_type->name, 297 current->fs->pwd.mnt->mnt_sb->s_type->name,
@@ -488,5 +488,5 @@ void __init prepare_namespace(void)
488out: 488out:
489 devtmpfs_mount("dev"); 489 devtmpfs_mount("dev");
490 sys_mount(".", "/", NULL, MS_MOVE, NULL); 490 sys_mount(".", "/", NULL, MS_MOVE, NULL);
491 sys_chroot("."); 491 sys_chroot((const char __user __force *)".");
492} 492}
diff --git a/init/do_mounts_md.c b/init/do_mounts_md.c
index 69aebbf8fd2d..32c4799b8c91 100644
--- a/init/do_mounts_md.c
+++ b/init/do_mounts_md.c
@@ -283,7 +283,7 @@ static void __init autodetect_raid(void)
283 283
284 wait_for_device_probe(); 284 wait_for_device_probe();
285 285
286 fd = sys_open("/dev/md0", 0, 0); 286 fd = sys_open((const char __user __force *) "/dev/md0", 0, 0);
287 if (fd >= 0) { 287 if (fd >= 0) {
288 sys_ioctl(fd, RAID_AUTORUN, raid_autopart); 288 sys_ioctl(fd, RAID_AUTORUN, raid_autopart);
289 sys_close(fd); 289 sys_close(fd);
diff --git a/init/do_mounts_rd.c b/init/do_mounts_rd.c
index bf3ef667bf36..6e1ee6987c78 100644
--- a/init/do_mounts_rd.c
+++ b/init/do_mounts_rd.c
@@ -168,7 +168,7 @@ int __init rd_load_image(char *from)
168 char rotator[4] = { '|' , '/' , '-' , '\\' }; 168 char rotator[4] = { '|' , '/' , '-' , '\\' };
169#endif 169#endif
170 170
171 out_fd = sys_open("/dev/ram", O_RDWR, 0); 171 out_fd = sys_open((const char __user __force *) "/dev/ram", O_RDWR, 0);
172 if (out_fd < 0) 172 if (out_fd < 0)
173 goto out; 173 goto out;
174 174
@@ -267,7 +267,7 @@ noclose_input:
267 sys_close(out_fd); 267 sys_close(out_fd);
268out: 268out:
269 kfree(buf); 269 kfree(buf);
270 sys_unlink("/dev/ram"); 270 sys_unlink((const char __user __force *) "/dev/ram");
271 return res; 271 return res;
272} 272}
273 273
diff --git a/init/initramfs.c b/init/initramfs.c
index 4b9c20205092..d9c6e782ff53 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -528,7 +528,7 @@ static void __init clean_rootfs(void)
528 struct linux_dirent64 *dirp; 528 struct linux_dirent64 *dirp;
529 int num; 529 int num;
530 530
531 fd = sys_open("/", O_RDONLY, 0); 531 fd = sys_open((const char __user __force *) "/", O_RDONLY, 0);
532 WARN_ON(fd < 0); 532 WARN_ON(fd < 0);
533 if (fd < 0) 533 if (fd < 0)
534 return; 534 return;
@@ -590,7 +590,8 @@ static int __init populate_rootfs(void)
590 } 590 }
591 printk(KERN_INFO "rootfs image is not initramfs (%s)" 591 printk(KERN_INFO "rootfs image is not initramfs (%s)"
592 "; looks like an initrd\n", err); 592 "; looks like an initrd\n", err);
593 fd = sys_open("/initrd.image", O_WRONLY|O_CREAT, 0700); 593 fd = sys_open((const char __user __force *) "/initrd.image",
594 O_WRONLY|O_CREAT, 0700);
594 if (fd >= 0) { 595 if (fd >= 0) {
595 sys_write(fd, (char *)initrd_start, 596 sys_write(fd, (char *)initrd_start,
596 initrd_end - initrd_start); 597 initrd_end - initrd_start);
diff --git a/init/noinitramfs.c b/init/noinitramfs.c
index f4c1a3a1b8c5..267739d85179 100644
--- a/init/noinitramfs.c
+++ b/init/noinitramfs.c
@@ -29,17 +29,17 @@ static int __init default_rootfs(void)
29{ 29{
30 int err; 30 int err;
31 31
32 err = sys_mkdir("/dev", 0755); 32 err = sys_mkdir((const char __user __force *) "/dev", 0755);
33 if (err < 0) 33 if (err < 0)
34 goto out; 34 goto out;
35 35
36 err = sys_mknod((const char __user *) "/dev/console", 36 err = sys_mknod((const char __user __force *) "/dev/console",
37 S_IFCHR | S_IRUSR | S_IWUSR, 37 S_IFCHR | S_IRUSR | S_IWUSR,
38 new_encode_dev(MKDEV(5, 1))); 38 new_encode_dev(MKDEV(5, 1)));
39 if (err < 0) 39 if (err < 0)
40 goto out; 40 goto out;
41 41
42 err = sys_mkdir("/root", 0700); 42 err = sys_mkdir((const char __user __force *) "/root", 0700);
43 if (err < 0) 43 if (err < 0)
44 goto out; 44 goto out;
45 45