From: David Woodhouse Date: Wed, 8 Mar 2006 05:55:36 +0000 (-0800) Subject: [PATCH] jffs2: avoid divide-by-zero X-Git-Tag: v2.6.16-rc6~67 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=e96fb230cc97760e448327c0de612cfba94ca7bf;p=linux-2.6-omap-h63xx.git [PATCH] jffs2: avoid divide-by-zero Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c index 3e51dd1da8a..cf55b221fc2 100644 --- a/fs/jffs2/scan.c +++ b/fs/jffs2/scan.c @@ -233,7 +233,7 @@ int jffs2_scan_medium(struct jffs2_sb_info *c) c->nextblock->dirty_size = 0; } #ifdef CONFIG_JFFS2_FS_WRITEBUFFER - if (!jffs2_can_mark_obsolete(c) && c->nextblock && (c->nextblock->free_size % c->wbuf_pagesize)) { + if (!jffs2_can_mark_obsolete(c) && c->wbuf_pagesize && c->nextblock && (c->nextblock->free_size % c->wbuf_pagesize)) { /* If we're going to start writing into a block which already contains data, and the end of the data isn't page-aligned, skip a little and align it. */