mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-09-22 09:34:56 +02:00
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:
committed by
Namjae Jeon
parent
ec8676c84f
commit
7c76484fbb
+1
-4
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user