64 bit problem in fs/jffs2/wbuf.c
Jörn Engel
joern at wohnheim.fh-wedel.de
Wed Jun 26 05:55:01 EDT 2002
Hi!
I've tripped into a strange problem while modifying the jffs2 nand
support for nor flashes with ecc checking.
The problem appears to be that jffs2_flash_writev defines the
parameter "to" to be loff_t, which is 64 bit (at least on ppc). Only
the lower 32 bit appear to be used and the upper should be all zeros.
But I have one occasion, where the high bits contain 0xc02fdd18, which
causes a sanity check in wbuf.c, line 347 to fail.
A straightforward fix appears to be a cast, the patch is appended.
The high bits should not contain any junk in the first place, but at
least, this ignores them in this position.
Thomas or David, is this a really stupid idea or can I search for
further bugs elsewhere?
Joern
--- wbuf.c Wed Jun 19 18:56:26 2002
+++ wbuf.c.new Wed Jun 26 11:27:27 2002
@@ -234,7 +234,7 @@
c->wbuf_len = PAGE_MOD(to);
}
- if (to != PAD(c->wbuf_ofs + c->wbuf_len)) {
+ if ((unsigned long)to != PAD(c->wbuf_ofs + c->wbuf_len)) {
/* We're not writing immediately after the writebuffer. Bad. */
printk(KERN_CRIT "jffs2_flash_writev(): Non-contiguous write to %08lx\n", (unsigned long)to);
if (c->wbuf_len)
More information about the linux-mtd
mailing list