Merge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac802...
[cascardo/linux.git] / init / do_mounts_rd.c
index 6212586..7c098ac 100644 (file)
@@ -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 <linux/kernel.h>
 #include <linux/fs.h>
@@ -48,6 +57,11 @@ static int __init crd_load(int in_fd, int out_fd, decompress_fn deco);
  *     cramfs
  *     squashfs
  *     gzip
+ *     bzip2
+ *     lzma
+ *     xz
+ *     lzo
+ *     lz4
  */
 static int __init
 identify_ramdisk_image(int fd, int start_block, decompress_fn *decompressor)
@@ -181,7 +195,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 +294,7 @@ noclose_input:
        sys_close(out_fd);
 out:
        kfree(buf);
-       sys_unlink((const char __user __force *) "/dev/ram");
+       sys_unlink("/dev/ram");
        return res;
 }
 
@@ -333,6 +347,13 @@ static int __init crd_load(int in_fd, int out_fd, decompress_fn deco)
        int result;
        crd_infd = in_fd;
        crd_outfd = out_fd;
+
+       if (!deco) {
+               pr_emerg("Invalid ramdisk decompression routine.  "
+                        "Select appropriate config option.\n");
+               panic("Could not decompress initial ramdisk image.");
+       }
+
        result = deco(NULL, 0, compr_fill, compr_flush, NULL, NULL, error);
        if (decompress_error)
                result = 1;