nand-bb: fix writing to the end of a .bb device
As nand_bb_write_buf calls mtd_write(bb->mtd, cur_ofs, now, ...) the limit that now should be checked against is bb->mtd->size - cur_ofs. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
e0ff988ad8
commit
faa369e9c5
|
@ -99,7 +99,7 @@ static int nand_bb_write_buf(struct nand_bb *bb, size_t count)
|
|||
loff_t cur_ofs = bb->offset & ~(BB_WRITEBUF_SIZE - 1);
|
||||
|
||||
while (count) {
|
||||
loff_t max = bb->mtd->size - bb->offset;
|
||||
loff_t max = bb->mtd->size - cur_ofs;
|
||||
|
||||
if (max <= 0)
|
||||
return -ENOSPC;
|
||||
|
|
Loading…
Reference in New Issue