]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - init/do_mounts_rd.c
arm: imx6: defconfig: update tx6 defconfigs
[karo-tx-linux.git] / init / do_mounts_rd.c
index 01f1306aa26e2bfa0fd6fa273fc0754d117fa389..6be2879cca66971859b1c51ff80451616ab13975 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>
@@ -54,20 +63,19 @@ identify_ramdisk_image(int fd, int start_block, decompress_fn *decompressor)
 {
        const int size = 512;
        struct minix_super_block *minixsb;
-       struct ext2_super_block *ext2sb;
        struct romfs_super_block *romfsb;
        struct cramfs_super *cramfsb;
        struct squashfs_super_block *squashfsb;
        int nblocks = -1;
        unsigned char *buf;
        const char *compress_name;
+       unsigned long n;
 
        buf = kmalloc(size, GFP_KERNEL);
        if (!buf)
                return -ENOMEM;
 
        minixsb = (struct minix_super_block *) buf;
-       ext2sb = (struct ext2_super_block *) buf;
        romfsb = (struct romfs_super_block *) buf;
        cramfsb = (struct cramfs_super *) buf;
        squashfsb = (struct squashfs_super_block *) buf;
@@ -150,12 +158,12 @@ identify_ramdisk_image(int fd, int start_block, decompress_fn *decompressor)
        }
 
        /* Try ext2 */
-       if (ext2sb->s_magic == cpu_to_le16(EXT2_SUPER_MAGIC)) {
+       n = ext2_image_size(buf);
+       if (n) {
                printk(KERN_NOTICE
                       "RAMDISK: ext2 filesystem found at block %d\n",
                       start_block);
-               nblocks = le32_to_cpu(ext2sb->s_blocks_count) <<
-                       le32_to_cpu(ext2sb->s_log_block_size);
+               nblocks = n;
                goto done;
        }
 
@@ -182,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;
 
@@ -281,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;
 }