From: Chao Yu via Linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net>
To: Xinping Zhang <zhangxp1998@gmail.com>,
linux-f2fs-devel@lists.sourceforge.net
Cc: jaegeuk@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [f2fs-dev] [PATCH 1/5] f2fs: avoid underflow when counting free NIDs
Date: Thu, 27 Aug 2026 11:39:42 +0800 [thread overview]
Message-ID: <ed48c7f2-1649-430b-a2bc-f44d1d80a632@kernel.org> (raw)
In-Reply-To: <CAH=xXfG2Hzc-kNAPqEUsTJ4hwrQ-gYEnFrXHGxL7qpYpggkLUQ@mail.gmail.com>
On 8/27/26 05:39, Xinping Zhang wrote:
> __count_free_nids() subtracts the retention threshold before checking
> whether the cached count exceeds it. The operands are unsigned, so a
> smaller cache wraps before the result is assigned to long.
>
> The PAGE_SIZE-derived threshold happens to make this an unsigned long
> subtraction, whose wrapped result becomes negative when converted to
> long by supported toolchains. Do not rely on operand width or
> unsigned-to-signed conversion. Compare values before subtracting.
>
Cc: stable@kernel.org
Fixes: 1b38dc8e74a3 ("f2fs: shrink nat_cache entries")
Fixes: 02110a4fd531 ("f2fs: avoid casted negative value as shrink count")
> Signed-off-by: Kelvin Zhang <zhangxp1998@gmail.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Thanks,
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next prev parent reply other threads:[~2026-08-27 3:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-26 21:39 [f2fs-dev] [PATCH 0/5] f2fs: prepare metadata layouts for runtime block sizes Xinping Zhang
2026-08-26 21:39 ` [f2fs-dev] [PATCH 1/5] f2fs: avoid underflow when counting free NIDs Xinping Zhang
2026-08-27 3:39 ` Chao Yu via Linux-f2fs-devel [this message]
2026-08-31 23:22 ` Chao Yu via Linux-f2fs-devel
2026-09-01 1:21 ` [f2fs-dev] [PATCH v2] " Kelvin Zhang
2026-08-26 21:39 ` [f2fs-dev] [PATCH 2/5] f2fs: describe SIT block layout dynamically Xinping Zhang
2026-08-26 21:39 ` [f2fs-dev] [PATCH 3/5] f2fs: describe orphan " Xinping Zhang
2026-08-26 21:39 ` [f2fs-dev] [PATCH 4/5] f2fs: describe dentry " Xinping Zhang
2026-08-26 21:39 ` [f2fs-dev] [PATCH 5/5] f2fs: describe inode node " Xinping Zhang
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=ed48c7f2-1649-430b-a2bc-f44d1d80a632@kernel.org \
--to=linux-f2fs-devel@lists.sourceforge.net \
--cc=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=zhangxp1998@gmail.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.