[PATCH v4 3/3] mtd: Remove duplicate checks on mtd_oob_ops parameter
boris.brezillon at free-electrons.com
Mon Jan 8 14:30:10 PST 2018
On Mon, 8 Jan 2018 23:04:55 +0100
Miquel RAYNAL <miquel.raynal at free-electrons.com> wrote:
> Hello Boris,
> On Mon, 8 Jan 2018 22:15:42 +0100
> Boris Brezillon <boris.brezillon at free-electrons.com> wrote:
> > Some of the check done in custom ->_read/write_oob() implementation
> > are already done by the core (in mtd_check_oob_ops()).
> Not sure this is relevant here as your series introduces changes for
> the SPI NAND framework, but there are other places where these checks
> are, IMHO, also redundant and could be removed. The "past end" string
> when grepped in the MTD folder core returns a few more hits.
> In the NAND core:
> - nand_do_read_oob()
> - nand_read_oob()
> - nand_do_write_oob()
> - nand_write_oob()
That's true for nand_read/write_oob(). The one in nand_do_write_oob()
is still needed because mtd_check_oob_ops() allows OOB writes crossing a
page boundary. Finally, I don't see any boundary checks in
> Maybe also in onenand_base.c, but I am less confident for this one:
> - onenand_bbt_read_oob()
Unfortunately no, this function is directly called from onenand_bbt.c,
which means the MTD layer layer is completely bypassed. I also found
boundary checks in onenand_mlc_read_ops_nolock(), but again, this
function is called from do_otp_read() which is not going through
> What do you think?
I'll remove the extra checks in nand_read/write_oob(). For the other
ones, one solution would be to expose mtd_check_oob_ops(), but I'll keep
that for later.
More information about the linux-mtd