aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cramfs
diff options
context:
space:
mode:
authorAndi Drebes <lists-receive@programmierforen.de>2007-10-17 02:27:12 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-17 11:42:53 -0400
commitac8d35c5658377c280dc830352f66233e2f76f73 (patch)
treebf0f460defa448c4a01c8d3acb6fa1d03c48fc36 /fs/cramfs
parent7f44c3621a41576d755668c48d0caf894c228fa9 (diff)
cramfs: error message about endianess
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@programmierforen.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/cramfs')
-rw-r--r--fs/cramfs/inode.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c
index 3d194a2be3f5..5c817bd08389 100644
--- a/fs/cramfs/inode.c
+++ b/fs/cramfs/inode.c
@@ -258,12 +258,21 @@ static int cramfs_fill_super(struct super_block *sb, void *data, int silent)
258 258
259 /* Do sanity checks on the superblock */ 259 /* Do sanity checks on the superblock */
260 if (super.magic != CRAMFS_MAGIC) { 260 if (super.magic != CRAMFS_MAGIC) {
261 /* check for wrong endianess */
262 if (super.magic == CRAMFS_MAGIC_WEND) {
263 if (!silent)
264 printk(KERN_ERR "cramfs: wrong endianess\n");
265 goto out;
266 }
267
261 /* check at 512 byte offset */ 268 /* check at 512 byte offset */
262 mutex_lock(&read_mutex); 269 mutex_lock(&read_mutex);
263 memcpy(&super, cramfs_read(sb, 512, sizeof(super)), sizeof(super)); 270 memcpy(&super, cramfs_read(sb, 512, sizeof(super)), sizeof(super));
264 mutex_unlock(&read_mutex); 271 mutex_unlock(&read_mutex);
265 if (super.magic != CRAMFS_MAGIC) { 272 if (super.magic != CRAMFS_MAGIC) {
266 if (!silent) 273 if (super.magic == CRAMFS_MAGIC_WEND && !silent)
274 printk(KERN_ERR "cramfs: wrong endianess\n");
275 else if (!silent)
267 printk(KERN_ERR "cramfs: wrong magic\n"); 276 printk(KERN_ERR "cramfs: wrong magic\n");
268 goto out; 277 goto out;
269 } 278 }