浏览代码

[JFFS2] Correct buggy length checks

The previous changes introduced wrong length calculations.

Signed-off-by: Artem B. Bityutskiy <dedekind@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Artem B. Bityutskiy 20 年之前
父节点
当前提交
3c09133739
共有 2 个文件被更改,包括 4 次插入4 次删除
  1. 2 2
      fs/jffs2/nodelist.c
  2. 2 2
      fs/jffs2/readinode.c

+ 2 - 2
fs/jffs2/nodelist.c

@@ -7,7 +7,7 @@
  *
  *
  * For licensing information, see the file 'LICENCE' in this directory.
  * For licensing information, see the file 'LICENCE' in this directory.
  *
  *
- * $Id: nodelist.c,v 1.107 2005/08/03 09:26:46 dedekind Exp $
+ * $Id: nodelist.c,v 1.108 2005/08/04 11:39:59 dedekind Exp $
  *
  *
  */
  */
 
 
@@ -412,7 +412,7 @@ static int check_node_data(struct jffs2_sb_info *c, struct jffs2_tmp_dnode_info
 
 
 	/* Calculate how many bytes were already checked */
 	/* Calculate how many bytes were already checked */
 	ofs = ref_offset(ref) + sizeof(struct jffs2_raw_inode);
 	ofs = ref_offset(ref) + sizeof(struct jffs2_raw_inode);
-	len = ofs - (ofs & (PAGE_CACHE_SIZE - 1));
+	len = ofs & (c->wbuf_pagesize - 1);
 	len = c->wbuf_pagesize - len;
 	len = c->wbuf_pagesize - len;
 
 
 	if (len >= tn->csize) {
 	if (len >= tn->csize) {

+ 2 - 2
fs/jffs2/readinode.c

@@ -7,7 +7,7 @@
  *
  *
  * For licensing information, see the file 'LICENCE' in this directory.
  * For licensing information, see the file 'LICENCE' in this directory.
  *
  *
- * $Id: readinode.c,v 1.137 2005/08/03 09:26:46 dedekind Exp $
+ * $Id: readinode.c,v 1.138 2005/08/03 09:28:06 dedekind Exp $
  *
  *
  */
  */
 
 
@@ -278,7 +278,7 @@ static inline int read_dnode(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
 
 
 			/* If we actually calculated the whole data CRC
 			/* If we actually calculated the whole data CRC
 			 * and it is wrong, drop the node. */
 			 * and it is wrong, drop the node. */
-			if (len == csize && unlikely(tn->partial_crc != je32_to_cpu(rd->data_crc))) {
+			if (len >= csize && unlikely(tn->partial_crc != je32_to_cpu(rd->data_crc))) {
 				JFFS2_NOTICE("wrong data CRC in data node at 0x%08x: read %#08x, calculated %#08x.\n",
 				JFFS2_NOTICE("wrong data CRC in data node at 0x%08x: read %#08x, calculated %#08x.\n",
 					ref_offset(ref), tn->partial_crc, je32_to_cpu(rd->data_crc));
 					ref_offset(ref), tn->partial_crc, je32_to_cpu(rd->data_crc));
 				goto free_out;
 				goto free_out;