Skip to content

Commit

Permalink
mtd: nand: omap: fix ecclayout->oobfree->length
Browse files Browse the repository at this point in the history
This patch excludes reserved-marker byte-position from oobfree->length
calculation. Thus all bytes from oobfree->offset till end of OOB are free.

CC: <stable@vger.kernel.org> # 3.13.x+
Signed-off-by: Pekon Gupta <pekon@ti.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
  • Loading branch information
Pekon Gupta authored and Brian Norris committed Feb 23, 2014
1 parent aa6092f commit bb38eef
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/mtd/nand/omap2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1994,9 +1994,8 @@ static int omap_nand_probe(struct platform_device *pdev)
goto return_error;
}

/* populate remaining ECC layout data */
ecclayout->oobfree->length = mtd->oobsize - (BADBLOCK_MARKER_LENGTH +
ecclayout->eccbytes);
/* all OOB bytes from oobfree->offset till end off OOB are free */
ecclayout->oobfree->length = mtd->oobsize - ecclayout->oobfree->offset;
/* check if NAND device's OOB is enough to store ECC signatures */
if (mtd->oobsize < (ecclayout->eccbytes + BADBLOCK_MARKER_LENGTH)) {
pr_err("not enough OOB bytes required = %d, available=%d\n",
Expand Down

0 comments on commit bb38eef

Please sign in to comment.