From c67e5382fb3f312c95d8d01db40fb398e6da454d Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Thu, 31 May 2012 16:26:10 -0700 Subject: init: disable sparse checking of the mount.o source files The init/mount.o source files produce a number of sparse warnings of the type: warning: incorrect type in argument 1 (different address spaces) expected char [noderef] *dev_name got char *name This is due to the syscalls expecting some of the arguments to be user pointers but they are being passed as kernel pointers. This is harmless but adds a lot of noise to a sparse build. To limit the noise just disable the sparse checking in the relevant source files, but still display a warning so that the user knows this has been done. Since the sparse checking has been disabled we can also remove the __user __force casts that are scattered thru the source. Signed-off-by: H Hartley Sweeten Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- init/initramfs.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'init/initramfs.c') diff --git a/init/initramfs.c b/init/initramfs.c index 8216c303b082..84c6bf111300 100644 --- a/init/initramfs.c +++ b/init/initramfs.c @@ -1,3 +1,13 @@ +/* + * Many of the syscalls used in this file expect some of the arguments + * to be __user pointers not __kernel pointers. To limit the sparse + * noise, turn off sparse checking for this file. + */ +#ifdef __CHECKER__ +#undef __CHECKER__ +#warning "Sparse checking disabled for this file" +#endif + #include #include #include @@ -74,7 +84,7 @@ static void __init free_hash(void) } } -static long __init do_utime(char __user *filename, time_t mtime) +static long __init do_utime(char *filename, time_t mtime) { struct timespec t[2]; @@ -529,7 +539,7 @@ static void __init clean_rootfs(void) struct linux_dirent64 *dirp; int num; - fd = sys_open((const char __user __force *) "/", O_RDONLY, 0); + fd = sys_open("/", O_RDONLY, 0); WARN_ON(fd < 0); if (fd < 0) return; @@ -589,7 +599,7 @@ static int __init populate_rootfs(void) } printk(KERN_INFO "rootfs image is not initramfs (%s)" "; looks like an initrd\n", err); - fd = sys_open((const char __user __force *) "/initrd.image", + fd = sys_open("/initrd.image", O_WRONLY|O_CREAT, 0700); if (fd >= 0) { sys_write(fd, (char *)initrd_start, -- cgit v1.2.3