[PATCH] [JFFS2] fix unpoint length

Andy Lowe alowe at mvista.com
Fri Jan 12 18:05:24 EST 2007


[PATCH] [JFFS2] fix unpoint length

Fix a couple of instances in JFFS2 where the unpoint() routine is
being called with the wrong length in cases where the point() routine
truncated a request.

Signed-off-by: Andy Lowe <alowe at mvista.com>

Index: linux-2.6.19/fs/jffs2/nodelist.c
===================================================================
--- linux-2.6.19.orig/fs/jffs2/nodelist.c
+++ linux-2.6.19/fs/jffs2/nodelist.c
@@ -443,7 +443,7 @@ static int check_node_data(struct jffs2_
 		err = c->mtd->point(c->mtd, ofs, len, &retlen, &buffer);
 		if (!err && retlen < tn->csize) {
 			JFFS2_WARNING("MTD point returned len too short: %zu instead of %u.\n", retlen, tn->csize);
-			c->mtd->unpoint(c->mtd, buffer, ofs, len);
+			c->mtd->unpoint(c->mtd, buffer, ofs, retlen);
 		} else if (err)
 			JFFS2_WARNING("MTD point failed: error code %d.\n", err);
 		else
Index: linux-2.6.19/fs/jffs2/scan.c
===================================================================
--- linux-2.6.19.orig/fs/jffs2/scan.c
+++ linux-2.6.19/fs/jffs2/scan.c
@@ -102,7 +102,7 @@ int jffs2_scan_medium(struct jffs2_sb_in
 		if (!ret && pointlen < c->mtd->size) {
 			/* Don't muck about if it won't let us point to the whole flash */
 			D1(printk(KERN_DEBUG "MTD point returned len too short: 0x%zx\n", pointlen));
-			c->mtd->unpoint(c->mtd, flashbuf, 0, c->mtd->size);
+			c->mtd->unpoint(c->mtd, flashbuf, 0, pointlen);
 			flashbuf = NULL;
 		}
 		if (ret)






More information about the linux-mtd mailing list