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/do_mounts.c | 14 ++++++++++++-- init/do_mounts_initrd.c | 10 ++++++++++ init/do_mounts_md.c | 12 +++++++++++- init/do_mounts_rd.c | 13 +++++++++++-- init/initramfs.c | 16 +++++++++++++--- 5 files changed, 57 insertions(+), 8 deletions(-) (limited to 'init') diff --git a/init/do_mounts.c b/init/do_mounts.c index 42b0707c3481..d3f0aeed2d39 100644 --- a/init/do_mounts.c +++ b/init/do_mounts.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 @@ -330,7 +340,7 @@ static int __init do_mount_root(char *name, char *fs, int flags, void *data) if (err) return err; - sys_chdir((const char __user __force *)"/root"); + sys_chdir("/root"); s = current->fs->pwd.dentry->d_sb; ROOT_DEV = s->s_dev; printk(KERN_INFO @@ -556,5 +566,5 @@ void __init prepare_namespace(void) out: devtmpfs_mount("dev"); sys_mount(".", "/", NULL, MS_MOVE, NULL); - sys_chroot((const char __user __force *)"."); + sys_chroot("."); } diff --git a/init/do_mounts_initrd.c b/init/do_mounts_initrd.c index 9047330c73e9..135959a276be 100644 --- a/init/do_mounts_initrd.c +++ b/init/do_mounts_initrd.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 diff --git a/init/do_mounts_md.c b/init/do_mounts_md.c index 32c4799b8c91..8cb6db54285b 100644 --- a/init/do_mounts_md.c +++ b/init/do_mounts_md.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 @@ -283,7 +293,7 @@ static void __init autodetect_raid(void) wait_for_device_probe(); - fd = sys_open((const char __user __force *) "/dev/md0", 0, 0); + fd = sys_open("/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 6212586df29a..6be2879cca66 100644 --- a/init/do_mounts_rd.c +++ b/init/do_mounts_rd.c @@ -1,3 +1,12 @@ +/* + * 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 @@ -181,7 +190,7 @@ int __init rd_load_image(char *from) char rotator[4] = { '|' , '/' , '-' , '\\' }; #endif - out_fd = sys_open((const char __user __force *) "/dev/ram", O_RDWR, 0); + out_fd = sys_open("/dev/ram", O_RDWR, 0); if (out_fd < 0) goto out; @@ -280,7 +289,7 @@ noclose_input: sys_close(out_fd); out: kfree(buf); - sys_unlink((const char __user __force *) "/dev/ram"); + sys_unlink("/dev/ram"); return res; } 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 From 0a4dd35c67b144d8ef9432120105f1aab9293ee9 Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Thu, 31 May 2012 16:26:46 -0700 Subject: kconfig: update compression algorithm info There have been new compression algorithms added without updating nearby relevant descriptive text that refers to (a) the number of compression algorithms and (b) the most recent one. Fix these inconsistencies. Signed-off-by: Randy Dunlap Reported-by: Cc: Lasse Collin Cc: "H. Peter Anvin" Cc: Markus Trippelsdorf Cc: Alain Knaff Cc: Albin Tonnerre Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- init/Kconfig | 11 +++++------ usr/Kconfig | 10 +++++----- 2 files changed, 10 insertions(+), 11 deletions(-) (limited to 'init') diff --git a/init/Kconfig b/init/Kconfig index 81816b82860b..7dca2cebec99 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -167,7 +167,7 @@ config KERNEL_BZIP2 depends on HAVE_KERNEL_BZIP2 help Its compression ratio and speed is intermediate. - Decompression speed is slowest among the three. The kernel + Decompression speed is slowest among the choices. The kernel size is about 10% smaller with bzip2, in comparison to gzip. Bzip2 uses a large amount of memory. For modern kernels you will need at least 8MB RAM or more for booting. @@ -176,10 +176,9 @@ config KERNEL_LZMA bool "LZMA" depends on HAVE_KERNEL_LZMA help - The most recent compression algorithm. - Its ratio is best, decompression speed is between the other - two. Compression is slowest. The kernel size is about 33% - smaller with LZMA in comparison to gzip. + This compression algorithm's ratio is best. Decompression speed + is between gzip and bzip2. Compression is slowest. + The kernel size is about 33% smaller with LZMA in comparison to gzip. config KERNEL_XZ bool "XZ" @@ -200,7 +199,7 @@ config KERNEL_LZO bool "LZO" depends on HAVE_KERNEL_LZO help - Its compression ratio is the poorest among the 4. The kernel + Its compression ratio is the poorest among the choices. The kernel size is about 10% bigger than gzip; however its speed (both compression and decompression) is the fastest. diff --git a/usr/Kconfig b/usr/Kconfig index 65b845bd4e3e..085872bb2bb5 100644 --- a/usr/Kconfig +++ b/usr/Kconfig @@ -134,7 +134,7 @@ config INITRAMFS_COMPRESSION_BZIP2 depends on RD_BZIP2 help Its compression ratio and speed is intermediate. - Decompression speed is slowest among the four. The initramfs + Decompression speed is slowest among the choices. The initramfs size is about 10% smaller with bzip2, in comparison to gzip. Bzip2 uses a large amount of memory. For modern kernels you will need at least 8MB RAM or more for booting. @@ -143,9 +143,9 @@ config INITRAMFS_COMPRESSION_LZMA bool "LZMA" depends on RD_LZMA help - The most recent compression algorithm. - Its ratio is best, decompression speed is between the other - three. Compression is slowest. The initramfs size is about 33% + This algorithm's compression ratio is best. + Decompression speed is between the other choices. + Compression is slowest. The initramfs size is about 33% smaller with LZMA in comparison to gzip. config INITRAMFS_COMPRESSION_XZ @@ -161,7 +161,7 @@ config INITRAMFS_COMPRESSION_LZO bool "LZO" depends on RD_LZO help - Its compression ratio is the poorest among the four. The kernel + Its compression ratio is the poorest among the choices. The kernel size is about 10% bigger than gzip; however its speed (both compression and decompression) is the fastest. -- cgit v1.2.3