ntfs: Remove impossible condition

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>
Reviewed-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
This commit is contained in:
Ethan Tidmore
2026-02-26 18:26:12 +09:00
committed by Namjae Jeon
parent ec8676c84f
commit 7c76484fbb
+1 -4
View File
@@ -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;