aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/onenand/onenand_base.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/onenand/onenand_base.c')
-rw-r--r--drivers/mtd/onenand/onenand_base.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index 6df309b89e9a..553b24d93335 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -1186,6 +1186,13 @@ static int onenand_do_write_oob(struct mtd_info *mtd, loff_t to, size_t len,
1186 return -EINVAL; 1186 return -EINVAL;
1187 } 1187 }
1188 1188
1189 /* For compatibility with NAND: Do not allow write past end of page */
1190 if (column + len > oobsize) {
1191 DEBUG(MTD_DEBUG_LEVEL0, "onenand_write_oob: "
1192 "Attempt to write past end of page\n");
1193 return -EINVAL;
1194 }
1195
1189 /* Do not allow reads past end of device */ 1196 /* Do not allow reads past end of device */
1190 if (unlikely(to >= mtd->size || 1197 if (unlikely(to >= mtd->size ||
1191 column + len > ((mtd->size >> this->page_shift) - 1198 column + len > ((mtd->size >> this->page_shift) -