mtd/fs/jffs2 nodelist.c,1.77,1.78

David Woodhouse dwmw2 at infradead.org
Fri Mar 28 09:52:15 EST 2003


Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv16465

Modified Files:
	nodelist.c 
Log Message:
Fix some bogus sanity checks


Index: nodelist.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/nodelist.c,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -r1.77 -r1.78
--- nodelist.c	24 Feb 2003 21:47:28 -0000	1.77
+++ nodelist.c	28 Mar 2003 14:52:12 -0000	1.78
@@ -160,9 +160,9 @@
 				goto free_out;
 			}
 			/* sanity check */
-			if ((node.d.nsize + sizeof (node.d)) != je32_to_cpu (node.d.totlen)) {
-				printk(KERN_NOTICE "jffs2_get_inode_nodes(): Illegal nsize in node at 0x%08x: nsize 0x%02x\n",
-				       ref_offset(ref), node.d.nsize);
+			if (PAD((node.d.nsize + sizeof (node.d))) != PAD(je32_to_cpu (node.d.totlen))) {
+				printk(KERN_NOTICE "jffs2_get_inode_nodes(): Illegal nsize in node at 0x%08x: nsize 0x%02x, totlen %04x\n",
+				       ref_offset(ref), node.d.nsize, je32_to_cpu(node.d.totlen));
 				jffs2_mark_node_obsolete(c, ref);
 				spin_lock(&c->erase_completion_lock);
 				continue;
@@ -259,9 +259,9 @@
 				}
 				
 				/* sanity checks */
-				if ( je32_to_cpu (node.i.offset) > c->flash_size || je32_to_cpu (node.i.csize) > c->sector_size
-					|| (je32_to_cpu (node.i.csize) + sizeof (struct jffs2_raw_inode)) != je32_to_cpu (node.i.totlen)) {
-					printk (KERN_NOTICE "jffs2_get_inode_nodes(): Inode corrupted at 0x%08x, totlen %d, #ino  %d, version %d, isize %d, csize %d, dsize %d \n",
+				if ( je32_to_cpu(node.i.offset) + je32_to_cpu(node.i.dsize) > je32_to_cpu(node.i.isize) ||
+				     PAD(je32_to_cpu(node.i.csize) + sizeof (node.i)) != PAD(je32_to_cpu(node.i.totlen))) {
+					printk(KERN_NOTICE "jffs2_get_inode_nodes(): Inode corrupted at 0x%08x, totlen %d, #ino  %d, version %d, isize %d, csize %d, dsize %d \n",
 						ref_offset(ref),  je32_to_cpu(node.i.totlen),  je32_to_cpu(node.i.ino),
 						je32_to_cpu(node.i.version),  je32_to_cpu(node.i.isize), 
 						je32_to_cpu(node.i.csize), je32_to_cpu(node.i.dsize));





More information about the linux-mtd-cvs mailing list