[PATCH] fs/ntfs3: Remove the unnecessary 'if' statement

Qianqiang Liu posted 1 patch 2 months, 2 weeks ago
fs/ntfs3/record.c | 4 ----
1 file changed, 4 deletions(-)
[PATCH] fs/ntfs3: Remove the unnecessary 'if' statement
Posted by Qianqiang Liu 2 months, 2 weeks ago
The 'asize' was already checked to be less than SIZEOF_RESIDENT.

Signed-off-by: Qianqiang Liu <qianqiang.liu@163.com>
---
 fs/ntfs3/record.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/fs/ntfs3/record.c b/fs/ntfs3/record.c
index 427c71be0f08..0f400366231d 100644
--- a/fs/ntfs3/record.c
+++ b/fs/ntfs3/record.c
@@ -268,10 +268,6 @@ struct ATTRIB *mi_enum_attr(struct mft_inode *mi, struct ATTRIB *attr)
 
 	/* Check size of attribute. */
 	if (!attr->non_res) {
-		/* Check resident fields. */
-		if (asize < SIZEOF_RESIDENT)
-			return NULL;
-
 		t16 = le16_to_cpu(attr->res.data_off);
 		if (t16 > asize)
 			return NULL;
-- 
2.39.2
Re: [PATCH] fs/ntfs3: Remove the unnecessary 'if' statement
Posted by Qianqiang Liu 2 months, 2 weeks ago
Hi almaz,

On Wed, Sep 11, 2024 at 09:57:54AM +0800, Qianqiang Liu wrote:
> The 'asize' was already checked to be less than SIZEOF_RESIDENT.
> 
> Signed-off-by: Qianqiang Liu <qianqiang.liu@163.com>
> ---
>  fs/ntfs3/record.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/fs/ntfs3/record.c b/fs/ntfs3/record.c
> index 427c71be0f08..0f400366231d 100644
> --- a/fs/ntfs3/record.c
> +++ b/fs/ntfs3/record.c
> @@ -268,10 +268,6 @@ struct ATTRIB *mi_enum_attr(struct mft_inode *mi, struct ATTRIB *attr)
>  
>  	/* Check size of attribute. */
>  	if (!attr->non_res) {
> -		/* Check resident fields. */
> -		if (asize < SIZEOF_RESIDENT)
> -			return NULL;
> -
>  		t16 = le16_to_cpu(attr->res.data_off);
>  		if (t16 > asize)
>  			return NULL;
> -- 
> 2.39.2

Could you please review this patch?

-- 
Best,
Qianqiang Liu