linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: James Hilliard <james.hilliard1@gmail.com>
Cc: Richard Weinberger <richard@nod.at>,
	 Vignesh Raghavendra <vigneshr@ti.com>,
	 Boris Brezillon <bbrezillon@kernel.org>,
	linux-mtd@lists.infradead.org,  linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH] mtd: core: skip empty read and write requests
Date: Wed, 18 Nov 2026 11:43:19 +0100	[thread overview]
Message-ID: <87y0aqifnc.fsf@bootlin.com> (raw)
In-Reply-To: <20261104-submit-mtd-empty-io-v1-v1-1-3f6bcf474e2a@gmail.com> (James Hilliard's message of "Wed, 04 Nov 2026 22:03:38 -0700")

On 04/11/2026 at 22:03:38 -07, James Hilliard <james.hilliard1@gmail.com> wrote:

> Converting mtd_read() and mtd_write() to wrappers around the OOB helpers
> removed their zero-length checks. Neither mtd_read_oob() nor
> mtd_write_oob() stops an empty request from reaching the driver.
>

Yes

> For example, the raw NAND read paths select a target and can read a page
> or its OOB area before checking the remaining length. An empty request
> at the end of the device can therefore select a target past the last
> available one.

No, there is a guard against that.

An empty request at the end of the device can therefore compute a die
index past the last available one and hit the WARN_ON() in
nand_select_target().

> Return success from the common helpers when both lengths are zero,

Ok

> after mtd_check_oob_ops() has normalized lengths for absent buffers.

This is opaque to me, just drop.

> Keep the existing range, write-protection and operation-support checks,
> and clear the per-request read statistics before returning. Both return
> lengths have already been initialized to zero.
>
> Fixes: 2431c4f5b46c ("mtd: Implement mtd_{read,write}() as wrappers around mtd_{read,write}_oob()")
> Cc: stable@vger.kernel.org
> Link: https://lore.kernel.org/r/sashiko-outbox-198544@kernel.org
> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>

Thanks,
Miquèl

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

      reply	other threads:[~2026-11-18 10:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05  5:03 [PATCH] mtd: core: skip empty read and write requests James Hilliard
2026-11-18 10:43 ` Miquel Raynal [this message]

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=87y0aqifnc.fsf@bootlin.com \
    --to=miquel.raynal@bootlin.com \
    --cc=bbrezillon@kernel.org \
    --cc=james.hilliard1@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard@nod.at \
    --cc=stable@vger.kernel.org \
    --cc=vigneshr@ti.com \
    /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;
as well as URLs for NNTP newsgroup(s).