From 0dec4c8bc6ed62a65b61594aa754e21270423796 Mon Sep 17 00:00:00 2001 From: Joakim Tjernlund Date: Sat, 10 Mar 2007 17:08:44 +0100 Subject: [JFFS2] Better fix for all-zero node headers No need to check for all-zero header since the header cannot be zero due to other checks. Replace the all-zero header check in readinode.c with a check for the magic word. Signed-off-by: Joakim Tjernlund Signed-off-by: David Woodhouse --- fs/jffs2/readinode.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'fs/jffs2/readinode.c') diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c index 49d4b0a67c55..b09fa23abe53 100644 --- a/fs/jffs2/readinode.c +++ b/fs/jffs2/readinode.c @@ -1054,10 +1054,10 @@ static int jffs2_get_inode_nodes(struct jffs2_sb_info *c, struct jffs2_inode_inf jffs2_mark_node_obsolete(c, ref); goto cont; } - /* Due to poor choice of crc32 seed, an all-zero node will have a correct CRC */ - if (!je32_to_cpu(node->u.hdr_crc) && !je16_to_cpu(node->u.nodetype) && - !je16_to_cpu(node->u.magic) && !je32_to_cpu(node->u.totlen)) { - JFFS2_NOTICE("All zero node header at %#08x.\n", ref_offset(ref)); + if (je16_to_cpu(node->u.magic) != JFFS2_MAGIC_BITMASK) { + /* Not a JFFS2 node, whinge and move on */ + JFFS2_NOTICE("Wrong magic bitmask 0x%04x in node header at %#08x.\n", + je16_to_cpu(node->u.magic), ref_offset(ref)); jffs2_mark_node_obsolete(c, ref); goto cont; } -- cgit