From: Andrew Morton <akpm@linux-foundation.org>
To: Yuwen Chen <ywen.chen@foxmail.com>
Cc: senozhatsky@chromium.org, bgeffon@google.com, licayy@outlook.com,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, minchan@kernel.org, richardycc@google.com
Subject: Re: [PATCH v2] zram: Fix the issue that the write - back limits might overflow
Date: Tue, 18 Nov 2025 09:58:21 -0800 [thread overview]
Message-ID: <20251118095821.ebea2deea23aea6921866aa8@linux-foundation.org> (raw)
In-Reply-To: <tencent_2FEBA8888C5B7C3CC495E17C29EFE76BA805@qq.com>
On Tue, 18 Nov 2025 16:15:50 +0800 Yuwen Chen <ywen.chen@foxmail.com> wrote:
> Since the value of bd_wb_limit is an unsigned number, when the
> page size is larger than 4 KB, it may cause an out-of-bounds situation.
Please update the changelog to fully describe this out-of-bounds
situation. Where does it occur, why, how, with what effects?
> This patch fixes the issue by limiting bd_wb_limit to be an
> integer multiple of PAGE_SIZE / 4096.
I don't see at all how clearing the lower 11 bits is related to "page
size is larger than 4 KB".
All quite confusing!
> --- a/drivers/block/zram/zram_drv.c
> +++ b/drivers/block/zram/zram_drv.c
> @@ -579,6 +579,7 @@ static ssize_t writeback_limit_store(struct device *dev,
> if (kstrtoull(buf, 10, &val))
> return ret;
>
> + val = val & (~((1UL << (PAGE_SHIFT - 12)) - 1));
Needs a little comment, I suggest.
> down_write(&zram->init_lock);
> zram->bd_wb_limit = val;
> up_write(&zram->init_lock);
> --
> 2.34.1
prev parent reply other threads:[~2025-11-18 17:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-18 8:15 Yuwen Chen
2025-11-18 17:58 ` Andrew Morton [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=20251118095821.ebea2deea23aea6921866aa8@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=bgeffon@google.com \
--cc=licayy@outlook.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=minchan@kernel.org \
--cc=richardycc@google.com \
--cc=senozhatsky@chromium.org \
--cc=ywen.chen@foxmail.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
all inboxes | Powered by JetHome®