All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ping Li" <leeonion.muyu@gmail.com>,
	miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com
Cc: tudor.ambarus@linaro.org, kyungmin.park@samsung.com,
	linux-mtd@lists.infradead.org
Subject: Re: [PATCH v4 2/4] mtd: mtdchar: clamp bounce buffer size to the remaining transfer
Date: Fri, 04 Dec 2026 09:25:45 +0000	[thread overview]
Message-ID: <sashiko-outbox-249502@kernel.org> (raw)
In-Reply-To: <20261204091640.444442-3-leeonion.muyu@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] mtd: mtdchar: Fixes tag cites 1da177e4c3f4 instead of
  3e45cf5e85a4
- [Low] mtd: mtdchar: commit message inaccurately claims vmalloc space
  waste
--

commit 2cebff5f1ea985ddd7180eb8271bf4aa1d5d75b0
Author: Ping Li <leeonion.muyu@gmail.com>

> mtd: mtdchar: clamp bounce buffer size to the remaining transfer
>
> mtdchar_read() and mtdchar_write() initialize the bounce buffer
> size with the raw count from userspace, then clamp count to what
> actually remains in the device.  The bounce buffer therefore gets
> allocated with the unclamped size: a read() of a few MiB near the
> end of a small device allocates a few MiB of bounce buffer to
> carry only a few KiB, which wastes memory and vmalloc space and
> may even fail with -ENOMEM for a trivially small transfer.

[Severity: Low]
Is the mention of vmalloc space accurate here?  Both mtdchar_read() and
mtdchar_write() still allocate via mtd_kmalloc_up_to(), which only calls
kmalloc() and never uses vmalloc space.

> Set the bounce buffer size after count has been clamped.
>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Cc: stable@vger.kernel.org
> Signed-off-by: Ping Li <leeonion.muyu@gmail.com>

[Severity: Low]
Should this Fixes tag point to 3e45cf5e85a4 ("mtd: mtdchar: retry large
buffer allocations") instead?  Prior to that commit, mtd_read() and
mtd_write() clamped count before allocating kbuf; initializing size from
the unclamped count was introduced when switching to mtd_kmalloc_up_to().

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261204091640.444442-1-leeonion.muyu@gmail.com?part=2

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

  reply	other threads:[~2026-12-04  9:25 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04  9:16 [PATCH v4 0/4] mtdchar: per-device bounce buffer policy Ping Li
2026-12-04  9:16 ` Ping Li
2026-12-04  9:16 ` [PATCH v4 1/4] mtd: core: add per-device bounce buffer allocation helper Ping Li
2026-12-04  9:16   ` Ping Li
2026-12-04  9:39   ` sashiko-bot
2026-12-04  9:16 ` [PATCH v4 2/4] mtd: mtdchar: clamp bounce buffer size to the remaining transfer Ping Li
2026-12-04  9:16   ` Ping Li
2026-12-04  9:25   ` sashiko-bot [this message]
2026-12-04  9:16 ` [PATCH v4 3/4] mtd: mtdchar: use mtd_alloc_buf() for the read/write bounce buffers Ping Li
2026-12-04  9:16   ` Ping Li
2026-12-04  9:39   ` sashiko-bot
2026-12-04  9:16 ` [PATCH v4 4/4] mtd: hyperbus: rpc-if: accept vmalloc'd " Ping Li
2026-12-04  9:16   ` Ping Li
2026-12-04  9:57   ` sashiko-bot

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=sashiko-outbox-249502@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=kyungmin.park@samsung.com \
    --cc=leeonion.muyu@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=tudor.ambarus@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.