[PATCH 2/3] ntfs: Add missing error code

Ethan Tidmore posted 3 patches 1 month, 1 week ago
[PATCH 2/3] ntfs: Add missing error code
Posted by Ethan Tidmore 1 month, 1 week ago
If ntfs_attr_iget() fails no error code is assigned to be returned.

Detected by Smatch:
fs/ntfs/attrib.c:2665 ntfs_attr_add() warn:
missing error code 'err'

Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
---
 fs/ntfs/attrib.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/ntfs/attrib.c b/fs/ntfs/attrib.c
index e260540eb7c5..71ad870eceac 100644
--- a/fs/ntfs/attrib.c
+++ b/fs/ntfs/attrib.c
@@ -2661,6 +2661,7 @@ int ntfs_attr_add(struct ntfs_inode *ni, __le32 type,
 	/* Open new attribute and resize it. */
 	attr_vi = ntfs_attr_iget(VFS_I(ni), type, name, name_len);
 	if (IS_ERR(attr_vi)) {
+		err = PTR_ERR(attr_vi);
 		ntfs_error(sb, "Failed to open just added attribute");
 		goto rm_attr_err_out;
 	}
-- 
2.53.0
Re: [PATCH 2/3] ntfs: Add missing error code
Posted by Hyunchul Lee 1 month, 1 week ago
On Thu, Feb 26, 2026 at 10:09:05AM -0600, Ethan Tidmore wrote:
> If ntfs_attr_iget() fails no error code is assigned to be returned.
> 
> Detected by Smatch:
> fs/ntfs/attrib.c:2665 ntfs_attr_add() warn:
> missing error code 'err'
> 
> Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>

Looks good to me. Thank for the patch

Reviewed-by: Hyunchul Lee <hyc.lee@gmail.com> 
> ---
>  fs/ntfs/attrib.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/ntfs/attrib.c b/fs/ntfs/attrib.c
> index e260540eb7c5..71ad870eceac 100644
> --- a/fs/ntfs/attrib.c
> +++ b/fs/ntfs/attrib.c
> @@ -2661,6 +2661,7 @@ int ntfs_attr_add(struct ntfs_inode *ni, __le32 type,
>  	/* Open new attribute and resize it. */
>  	attr_vi = ntfs_attr_iget(VFS_I(ni), type, name, name_len);
>  	if (IS_ERR(attr_vi)) {
> +		err = PTR_ERR(attr_vi);
>  		ntfs_error(sb, "Failed to open just added attribute");
>  		goto rm_attr_err_out;
>  	}
> -- 
> 2.53.0
> 

-- 
Thanks,
Hyunchul