public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Miquel RAYNAL <miquel.raynal@free-electrons.com>
Cc: David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Marek Vasut <marek.vasut@gmail.com>,
	Richard Weinberger <richard@nod.at>,
	Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>,
	linux-mtd@lists.infradead.org,
	Robert Jarzmik <robert.jarzmik@free.fr>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Peter Pan <peterpansjtu@gmail.com>,
	Frieder Schrempf <frieder.schrempf@exceet.de>,
	Ladislav Michl <ladis@linux-mips.org>
Subject: Re: [PATCH v4 3/3] mtd: Remove duplicate checks on mtd_oob_ops parameter
Date: Mon, 8 Jan 2018 23:30:10 +0100	[thread overview]
Message-ID: <20180108233010.5d7e7c3f@bbrezillon> (raw)
In-Reply-To: <20180108230455.10c0cb83@xps13>

On Mon, 8 Jan 2018 23:04:55 +0100
Miquel RAYNAL <miquel.raynal@free-electrons.com> wrote:

> Hello Boris,
> 
> On Mon,  8 Jan 2018 22:15:42 +0100
> Boris Brezillon <boris.brezillon@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
nand_do_read_oob().

> 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
mtd_check_oob_ops().

> 
> 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.

  reply	other threads:[~2018-01-08 22:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-08 21:15 [PATCH v4 0/4] mtd: Preparation patches for the SPI NAND framework Boris Brezillon
2018-01-08 21:15 ` [PATCH v4 1/3] mtd: mtdpart: Make ECC stat handling consistent Boris Brezillon
2018-01-08 21:25   ` Boris Brezillon
2018-01-10 20:27   ` Robert Jarzmik
2018-01-10 21:07     ` Boris Brezillon
2018-01-08 21:15 ` [PATCH v4 2/3] mtd: Fallback to ->_read/write_oob() when ->_read/write() is missing Boris Brezillon
2018-01-08 21:15 ` [PATCH v4 3/3] mtd: Remove duplicate checks on mtd_oob_ops parameter Boris Brezillon
2018-01-08 22:04   ` Miquel RAYNAL
2018-01-08 22:30     ` Boris Brezillon [this message]
2018-01-09  7:19       ` Miquel RAYNAL
2018-01-09  8:11         ` Boris Brezillon
2018-01-09  8:19           ` Miquel RAYNAL
2018-01-08 21:17 ` [PATCH v4 0/4] mtd: Preparation patches for the SPI NAND framework Boris Brezillon
2018-01-08 21:48 ` Ladislav Michl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180108233010.5d7e7c3f@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=computersforpeace@gmail.com \
    --cc=cyrille.pitchen@wedev4u.fr \
    --cc=dwmw2@infradead.org \
    --cc=frieder.schrempf@exceet.de \
    --cc=kyungmin.park@samsung.com \
    --cc=ladis@linux-mips.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=miquel.raynal@free-electrons.com \
    --cc=peterpansjtu@gmail.com \
    --cc=richard@nod.at \
    --cc=robert.jarzmik@free.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox