diff options
author | Artem B. Bityutskiy <dedekind@infradead.org> | 2005-08-17 15:57:43 +0100 |
---|---|---|
committer | Thomas Gleixner <tglx@mtd.linutronix.de> | 2005-11-06 20:29:56 +0100 |
commit | 280562b2104c9a0ca7efc5e716b6452a7ba820fa (patch) | |
tree | 6dcee70d0ec3da6fbb8afd9e05e6b73c1a46e97a /fs/jffs2/readinode.c | |
parent | 8d5df40954281a8e0f788b311f9c08f96e530ffa (diff) | |
download | op-kernel-dev-280562b2104c9a0ca7efc5e716b6452a7ba820fa.zip op-kernel-dev-280562b2104c9a0ca7efc5e716b6452a7ba820fa.tar.gz |
[JFFS2] Calculate CRC check starting point correctly
When data starts from the beginning of NAND page, 'len' must be zero, not
c->wbuf_page.
Thanks to Zoltan Sogor for reporting this problem.
Signed-off-by: Artem B. Bityutskiy <dedekind@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'fs/jffs2/readinode.c')
-rw-r--r-- | fs/jffs2/readinode.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c index 6d5adab..6f1e4a7 100644 --- a/fs/jffs2/readinode.c +++ b/fs/jffs2/readinode.c @@ -7,7 +7,7 @@ * * For licensing information, see the file 'LICENCE' in this directory. * - * $Id: readinode.c,v 1.140 2005/08/17 13:46:23 dedekind Exp $ + * $Id: readinode.c,v 1.141 2005/08/17 14:57:39 dedekind Exp $ * */ @@ -272,9 +272,9 @@ static inline int read_dnode(struct jffs2_sb_info *c, struct jffs2_raw_node_ref buf = (unsigned char *)rd + sizeof(*rd); /* len will be the read data length */ len = min_t(uint32_t, rdlen - sizeof(*rd), csize); - - if (len) - tn->partial_crc = crc = crc32(0, buf, len); + tn->partial_crc = crc32(0, buf, len); + + JFFS2_DBG_READINODE("Calculates CRC (%#08x) for %d bytes, csize %d\n", tn->partial_crc, len, csize); /* If we actually calculated the whole data CRC * and it is wrong, drop the node. */ @@ -327,8 +327,8 @@ static inline int read_dnode(struct jffs2_sb_info *c, struct jffs2_raw_node_ref else // normal case... tn->fn->size = je32_to_cpu(rd->dsize); - JFFS2_DBG_READINODE("dnode @%08x: ver %u, offset %#04x, dsize %#04x\n", - ref_offset(ref), je32_to_cpu(rd->version), je32_to_cpu(rd->offset), je32_to_cpu(rd->dsize)); + JFFS2_DBG_READINODE("dnode @%08x: ver %u, offset %#04x, dsize %#04x, csize %#04x\n", + ref_offset(ref), je32_to_cpu(rd->version), je32_to_cpu(rd->offset), je32_to_cpu(rd->dsize), csize); jffs2_add_tn_to_tree(tn, tnp); |