aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorArtem B. Bityutskiy <dedekind@infradead.org>2005-08-04 07:40:02 -0400
committerThomas Gleixner <tglx@mtd.linutronix.de>2005-11-06 12:35:36 -0500
commit3c09133739beff0d5ad457dfcfc85c7c350d3661 (patch)
tree171320f1919f6be98a90a08c3a88d84120456967 /fs
parent392435081e8cc6e02bdc4fa998050abb11d331b4 (diff)
[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>
Diffstat (limited to 'fs')
-rw-r--r--fs/jffs2/nodelist.c4
-rw-r--r--fs/jffs2/readinode.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/fs/jffs2/nodelist.c b/fs/jffs2/nodelist.c
index 007d52f394dd..b5f73ab6553c 100644
--- a/fs/jffs2/nodelist.c
+++ b/fs/jffs2/nodelist.c
@@ -7,7 +7,7 @@
7 * 7 *
8 * For licensing information, see the file 'LICENCE' in this directory. 8 * For licensing information, see the file 'LICENCE' in this directory.
9 * 9 *
10 * $Id: nodelist.c,v 1.107 2005/08/03 09:26:46 dedekind Exp $ 10 * $Id: nodelist.c,v 1.108 2005/08/04 11:39:59 dedekind Exp $
11 * 11 *
12 */ 12 */
13 13
@@ -412,7 +412,7 @@ static int check_node_data(struct jffs2_sb_info *c, struct jffs2_tmp_dnode_info
412 412
413 /* Calculate how many bytes were already checked */ 413 /* Calculate how many bytes were already checked */
414 ofs = ref_offset(ref) + sizeof(struct jffs2_raw_inode); 414 ofs = ref_offset(ref) + sizeof(struct jffs2_raw_inode);
415 len = ofs - (ofs & (PAGE_CACHE_SIZE - 1)); 415 len = ofs & (c->wbuf_pagesize - 1);
416 len = c->wbuf_pagesize - len; 416 len = c->wbuf_pagesize - len;
417 417
418 if (len >= tn->csize) { 418 if (len >= tn->csize) {
diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c
index e6076fa5560f..12a3aaeb2f7e 100644
--- a/fs/jffs2/readinode.c
+++ b/fs/jffs2/readinode.c
@@ -7,7 +7,7 @@
7 * 7 *
8 * For licensing information, see the file 'LICENCE' in this directory. 8 * For licensing information, see the file 'LICENCE' in this directory.
9 * 9 *
10 * $Id: readinode.c,v 1.137 2005/08/03 09:26:46 dedekind Exp $ 10 * $Id: readinode.c,v 1.138 2005/08/03 09:28:06 dedekind Exp $
11 * 11 *
12 */ 12 */
13 13
@@ -278,7 +278,7 @@ static inline int read_dnode(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
278 278
279 /* If we actually calculated the whole data CRC 279 /* If we actually calculated the whole data CRC
280 * and it is wrong, drop the node. */ 280 * and it is wrong, drop the node. */
281 if (len == csize && unlikely(tn->partial_crc != je32_to_cpu(rd->data_crc))) { 281 if (len >= csize && unlikely(tn->partial_crc != je32_to_cpu(rd->data_crc))) {
282 JFFS2_NOTICE("wrong data CRC in data node at 0x%08x: read %#08x, calculated %#08x.\n", 282 JFFS2_NOTICE("wrong data CRC in data node at 0x%08x: read %#08x, calculated %#08x.\n",
283 ref_offset(ref), tn->partial_crc, je32_to_cpu(rd->data_crc)); 283 ref_offset(ref), tn->partial_crc, je32_to_cpu(rd->data_crc));
284 goto free_out; 284 goto free_out;