summaryrefslogtreecommitdiff
path: root/drivers/mtd/mtdoops.c
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@rpsys.net>2008-07-26 12:17:41 +0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2008-10-18 14:51:13 +0400
commitecd5b3102322011610a2521c389ab5804c811837 (patch)
treee5e0916a3e321adc7c6b7f865de8b5403835350c /drivers/mtd/mtdoops.c
parenta52c8afdd035a72da55756d5e7f9fb35cc62dcf5 (diff)
downloadlinux-ecd5b3102322011610a2521c389ab5804c811837.tar.xz
[MTD] mtdoops: Fix an off by one error
Fix an off by one error in the mtdoops driver Signed-off-by: Richard Purdie <rpurdie@rpsys.net> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/mtdoops.c')
-rw-r--r--drivers/mtd/mtdoops.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/mtd/mtdoops.c b/drivers/mtd/mtdoops.c
index 5a680e1e61f1..f40e45727aed 100644
--- a/drivers/mtd/mtdoops.c
+++ b/drivers/mtd/mtdoops.c
@@ -99,7 +99,7 @@ static void mtdoops_inc_counter(struct mtdoops_context *cxt)
int ret;
cxt->nextpage++;
- if (cxt->nextpage > cxt->oops_pages)
+ if (cxt->nextpage >= cxt->oops_pages)
cxt->nextpage = 0;
cxt->nextcount++;
if (cxt->nextcount == 0xffffffff)
@@ -141,7 +141,7 @@ static void mtdoops_workfunc_erase(struct work_struct *work)
mod = (cxt->nextpage * OOPS_PAGE_SIZE) % mtd->erasesize;
if (mod != 0) {
cxt->nextpage = cxt->nextpage + ((mtd->erasesize - mod) / OOPS_PAGE_SIZE);
- if (cxt->nextpage > cxt->oops_pages)
+ if (cxt->nextpage >= cxt->oops_pages)
cxt->nextpage = 0;
}
@@ -158,7 +158,7 @@ badblock:
cxt->nextpage * OOPS_PAGE_SIZE);
i++;
cxt->nextpage = cxt->nextpage + (mtd->erasesize / OOPS_PAGE_SIZE);
- if (cxt->nextpage > cxt->oops_pages)
+ if (cxt->nextpage >= cxt->oops_pages)
cxt->nextpage = 0;
if (i == (cxt->oops_pages / (mtd->erasesize / OOPS_PAGE_SIZE))) {
printk(KERN_ERR "mtdoops: All blocks bad!\n");