Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0dec4c8bc6ed62a65b61594aa754e21270423796
Commit:     0dec4c8bc6ed62a65b61594aa754e21270423796
Parent:     df8e96f39103adf5a13332d784040a2c62667243
Author:     Joakim Tjernlund <[EMAIL PROTECTED]>
AuthorDate: Sat Mar 10 17:08:44 2007 +0100
Committer:  David Woodhouse <[EMAIL PROTECTED]>
CommitDate: Wed Apr 25 04:13:06 2007 +0100

    [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 <[EMAIL PROTECTED]>
    Signed-off-by: David Woodhouse <[EMAIL PROTECTED]>
---
 fs/jffs2/readinode.c |    8 ++++----
 fs/jffs2/scan.c      |   12 +-----------
 2 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c
index 49d4b0a..b09fa23 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;
                }
diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c
index 7a46a43..858e3ed 100644
--- a/fs/jffs2/scan.c
+++ b/fs/jffs2/scan.c
@@ -741,18 +741,8 @@ scan_more:
                        ofs += 4;
                        continue;
                }
-               /* Due to poor choice of crc32 seed, an all-zero node will have 
a correct CRC */
-               if (!je32_to_cpu(node->hdr_crc) && !je16_to_cpu(node->nodetype) 
&&
-                   !je16_to_cpu(node->magic) && !je32_to_cpu(node->totlen)) {
-                       noisy_printk(&noise, "jffs2_scan_eraseblock(): All zero 
node header at 0x%08x.\n", ofs);
-                       if ((err = jffs2_scan_dirty_space(c, jeb, 4)))
-                               return err;
-                       ofs += 4;
-                       continue;
-               }
 
-               if (ofs + je32_to_cpu(node->totlen) >
-                   jeb->offset + c->sector_size) {
+               if (ofs + je32_to_cpu(node->totlen) > jeb->offset + 
c->sector_size) {
                        /* Eep. Node goes over the end of the erase block. */
                        printk(KERN_WARNING "Node at 0x%08x with length 0x%08x 
would run over the end of the erase block\n",
                               ofs, je32_to_cpu(node->totlen));
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to