From: Hyunchul Lee <hyc.lee@gmail.com>
To: Ethan Tidmore <ethantidmore06@gmail.com>
Cc: linkinjeon@kernel.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] ntfs: Remove impossible condition
Date: Thu, 26 Feb 2026 14:40:15 +0900 [thread overview]
Message-ID: <aZ_cv1eMxOr-D704@hyunchul-PC02> (raw)
In-Reply-To: <20260226040355.1974628-3-ethantidmore06@gmail.com>
On Wed, Feb 25, 2026 at 10:03:55PM -0600, Ethan Tidmore wrote:
> The variable name_len is checked to see if it's larger than the macro
> NTFS_MAX_NAME_LEN however this condition is impossible because name_len
> is of type u8 and NTFS_MAX_NAME_LEN is hardcoded to be 255.
>
> Detected by Smatch:
> fs/ntfs/namei.c:1175 __ntfs_link() warn:
> impossible condition '(name_len > 255) => (0-255 > 255)'
>
> Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
Looks good to me. Thanks for the patch.
Reviewed-by: Hyunchul Lee <hyc.lee@gmail.com>
> ---
> fs/ntfs/namei.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/fs/ntfs/namei.c b/fs/ntfs/namei.c
> index cecfaabfbfe7..2952b377dda2 100644
> --- a/fs/ntfs/namei.c
> +++ b/fs/ntfs/namei.c
> @@ -1172,10 +1172,7 @@ static int __ntfs_link(struct ntfs_inode *ni, struct ntfs_inode *dir_ni,
>
> /* Create FILE_NAME attribute. */
> fn_len = sizeof(struct file_name_attr) + name_len * sizeof(__le16);
> - if (name_len > NTFS_MAX_NAME_LEN) {
> - err = -EIO;
> - goto err_out;
> - }
> +
> fn = kzalloc(fn_len, GFP_NOFS);
> if (!fn) {
> err = -ENOMEM;
> --
> 2.53.0
>
--
Thanks,
Hyunchul
next prev parent reply other threads:[~2026-02-26 5:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-26 4:03 [PATCH 0/2] ntfs: Fix two minor issues in namei.c Ethan Tidmore
2026-02-26 4:03 ` [PATCH 1/2] ntfs: Replace ERR_PTR(0) with NULL Ethan Tidmore
2026-02-26 5:39 ` Hyunchul Lee
2026-02-26 4:03 ` [PATCH 2/2] ntfs: Remove impossible condition Ethan Tidmore
2026-02-26 5:40 ` Hyunchul Lee [this message]
2026-02-26 9:29 ` [PATCH 0/2] ntfs: Fix two minor issues in namei.c Namjae Jeon
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=aZ_cv1eMxOr-D704@hyunchul-PC02 \
--to=hyc.lee@gmail.com \
--cc=ethantidmore06@gmail.com \
--cc=linkinjeon@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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