]> git.baikalelectronics.ru Git - uboot.git/commit
mtd: Add sanity checks in mtd_write/read_oob()
authorBoris Brezillon <boris.brezillon@free-electrons.com>
Thu, 16 Aug 2018 15:30:01 +0000 (17:30 +0200)
committerJagan Teki <jagan@amarulasolutions.com>
Thu, 20 Sep 2018 14:40:49 +0000 (20:10 +0530)
commitaf80702fa1a6fd5227892be499c2afc0eb0bf2b0
tree1ba5bf66ac3327c1365de7844269ad4060217d56
parentad47eba9decec110d5c3334d288d44386eff6ddd
mtd: Add sanity checks in mtd_write/read_oob()

Unlike what's done in mtd_read/write(), there are no checks to make sure
the parameters passed to mtd_read/write_oob() are consistent, which
forces implementers of ->_read/write_oob() to do it, which in turn leads
to code duplication and possibly errors in the logic.

Do general sanity checks, like ops fields consistency and range checking.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Cc: Peter Pan <peterpandong@micron.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
[Miquel: squashed the fix about the chip's size check]
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
drivers/mtd/mtdcore.c