Commit 52e4200a authored by Adrian Hunter's avatar Adrian Hunter Committed by Kyungmin Park

[MTD] OneNAND: Do not allow oob write past end of page

OneNAND can write oob to successive pages, but NAND
does not do that.  For compatibility, disallow OneNAND
from writing past the end of the page.
Signed-off-by: default avatarAdrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
parent 5b4246f1
...@@ -1186,6 +1186,13 @@ static int onenand_do_write_oob(struct mtd_info *mtd, loff_t to, size_t len, ...@@ -1186,6 +1186,13 @@ static int onenand_do_write_oob(struct mtd_info *mtd, loff_t to, size_t len,
return -EINVAL; return -EINVAL;
} }
/* For compatibility with NAND: Do not allow write past end of page */
if (column + len > oobsize) {
DEBUG(MTD_DEBUG_LEVEL0, "onenand_write_oob: "
"Attempt to write past end of page\n");
return -EINVAL;
}
/* Do not allow reads past end of device */ /* Do not allow reads past end of device */
if (unlikely(to >= mtd->size || if (unlikely(to >= mtd->size ||
column + len > ((mtd->size >> this->page_shift) - column + len > ((mtd->size >> this->page_shift) -
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment