patch-2.4.20 linux-2.4.20/fs/jffs2/scan.c
Next file: linux-2.4.20/fs/jffs2/super.c
Previous file: linux-2.4.20/fs/jffs2/readinode.c
Back to the patch index
Back to the overall index
-  Lines: 26
-  Date:
Thu Nov 28 15:53:15 2002
-  Orig file: 
linux-2.4.19/fs/jffs2/scan.c
-  Orig date: 
Fri Aug  2 17:39:45 2002
diff -urN linux-2.4.19/fs/jffs2/scan.c linux-2.4.20/fs/jffs2/scan.c
@@ -31,7 +31,7 @@
  * provisions above, a recipient may use your version of this file
  * under either the RHEPL or the GPL.
  *
- * $Id: scan.c,v 1.51.2.2 2002/02/23 13:34:31 dwmw2 Exp $
+ * $Id: scan.c,v 1.51.2.3 2002/07/25 20:49:06 dwmw2 Exp $
  *
  */
 #include <linux/kernel.h>
@@ -259,6 +259,16 @@
 			DIRTY_SPACE(4);
 			ofs += 4;
 			continue;
+		}
+
+		if (ofs + 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, node.totlen);
+			printk(KERN_WARNING "Perhaps the file system was created with the wrong erase size?\n");
+			DIRTY_SPACE(4);
+			ofs += 4;
+			continue;
 		}
 
 		switch(node.nodetype | JFFS2_NODE_ACCURATE) {
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)