Skip to contentSkip to conversation

ntfs: reparse: remove redundant NULL checks before kvfree()

PATCH Applied [email protected] 3 participants 3 messages Jul 3 – Jul 6

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ntfs: reparse: remove redundant NULL checks before kvfree()

From: Mohammad Shahid <[email protected]>

kvfree() safely handles NULL pointers, so the explicit NULL checks before calling kvfree() are unnecessary.

This issue was reported by ifnullfree.cocci.

---
 fs/ntfs/reparse.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
fs/ntfs/reparse.c +2 -4
index fa523dc3691e..ced4c675d91f 100644
@@ -317,8 +317,7 @@ unsigned int ntfs_make_symlink(struct ntfs_inode *ni)
 	} else
 		ni->flags &= ~FILE_ATTR_REPARSE_POINT;
 
-	if (reparse_attr)
-		kvfree(reparse_attr);
+	kvfree(reparse_attr);
 
 	return mode;
 }
@@ -358,8 +357,7 @@ unsigned int ntfs_reparse_tag_dt_types(struct ntfs_volume *vol, unsigned long mr
 		}
 	}
 
-	if (reparse_attr)
-		kvfree(reparse_attr);
+	kvfree(reparse_attr);
 
 	iput(vi);
 	return dt_type;
Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 1/1
#1 lore raw

2026년 7월 4일 (토) 오전 2:33, <[email protected]>님이 작성:

Quoted 9 lines

From: Mohammad Shahid <[email protected]>

kvfree() safely handles NULL pointers, so the explicit NULL checks before calling kvfree() are unnecessary.

This issue was reported by ifnullfree.cocci.

Looks good to me.

Quoted 31 lines
---
 fs/ntfs/reparse.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
fs/ntfs/reparse.c +2 -5
index fa523dc3691e..ced4c675d91f 100644
@@ -317,8 +317,7 @@ unsigned int ntfs_make_symlink(struct ntfs_inode *ni)
        } else
                ni->flags &= ~FILE_ATTR_REPARSE_POINT;
 
-       if (reparse_attr)
-               kvfree(reparse_attr);
+       kvfree(reparse_attr);
 
        return mode;
 }
@@ -358,8 +357,7 @@ unsigned int ntfs_reparse_tag_dt_types(struct ntfs_volume *vol, unsigned long mr
                }
        }
 
-       if (reparse_attr)
-               kvfree(reparse_attr);
+       kvfree(reparse_attr);
 
        iput(vi);
        return dt_type;
--

2.43.0

Signature · 2 lines
Thanks,
Hyunchul