The patch titled cramfs: error message about endianess has been added to the -mm tree. Its filename is cramfs-error-message-about-endianess.patch *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: cramfs: error message about endianess From: Andi Drebes <lists-receive@xxxxxxxxxxxxxxxxxxx> The README file in the cramfs subdirectory says: "All data is currently in host-endian format; neither mkcramfs nor the kernel ever do swabbing." If somebody tries to mount a cramfs with the wrong endianess, cramfs only complains about a wrong magic but doesn't inform the user that only the endianess isn't right. The following patch adds an error message to the cramfs sources. If a user tries to mount a cramfs with the wrong endianess using the patched sources, cramfs will display the message "cramfs: wrong endianess". Signed-off-by: Andi Drebes <lists-receive@xxxxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/cramfs/inode.c | 11 ++++++++++- include/linux/cramfs_fs.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff -puN fs/cramfs/inode.c~cramfs-error-message-about-endianess fs/cramfs/inode.c --- a/fs/cramfs/inode.c~cramfs-error-message-about-endianess +++ a/fs/cramfs/inode.c @@ -258,12 +258,21 @@ static int cramfs_fill_super(struct supe /* Do sanity checks on the superblock */ if (super.magic != CRAMFS_MAGIC) { + /* check for wrong endianess */ + if (super.magic == CRAMFS_MAGIC_WEND) { + if (!silent) + printk(KERN_ERR "cramfs: wrong endianess\n"); + goto out; + } + /* check at 512 byte offset */ mutex_lock(&read_mutex); memcpy(&super, cramfs_read(sb, 512, sizeof(super)), sizeof(super)); mutex_unlock(&read_mutex); if (super.magic != CRAMFS_MAGIC) { - if (!silent) + if (super.magic == CRAMFS_MAGIC_WEND && !silent) + printk(KERN_ERR "cramfs: wrong endianess\n"); + else if (!silent) printk(KERN_ERR "cramfs: wrong magic\n"); goto out; } diff -puN include/linux/cramfs_fs.h~cramfs-error-message-about-endianess include/linux/cramfs_fs.h --- a/include/linux/cramfs_fs.h~cramfs-error-message-about-endianess +++ a/include/linux/cramfs_fs.h @@ -4,6 +4,7 @@ #include <linux/types.h> #define CRAMFS_MAGIC 0x28cd3d45 /* some random number */ +#define CRAMFS_MAGIC_WEND 0x453dcd28 /* magic number with the wrong endianess */ #define CRAMFS_SIGNATURE "Compressed ROMFS" /* _ Patches currently in -mm which might be from lists-receive@xxxxxxxxxxxxxxxxxxx are git-dvb.patch cramfs-error-message-about-endianess.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html