Skip to contentSkip to conversation

ntfs3: Fix uninit buffer allocated by __getname()

PATCH In review Sidharth Seela 2 participants 2 messages Sep 23, 2025 – Nov 20, 2025 NTFS3 filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ntfs3: Fix uninit buffer allocated by __getname()

Fix uninit errors caused after buffer allocation given to 'de'; by initializing the buffer with zeroes. The fix was found by using KMSAN.

Reported-by [email protected]
Fixes 78ab59fee07f2 ("fs/ntfs3: Rework file operations")

--

fs/ntfs3/inode.c +1 -0
index 37cbbee7fa58..6b14c13bda68 100644
@@ -1716,6 +1716,7 @@ int ntfs_link_inode(struct inode *inode, struct dentry *dentry)
 	de = __getname();
 	if (!de)
 		return -ENOMEM;
+	memset(de, 0, PATH_MAX);
 
 	/* Mark rw ntfs as dirty. It will be cleared at umount. */
 	ntfs_set_state(sbi, NTFS_DIRTY_DIRTY);
Signature · 1 line
2.47.3
#1 lore raw
Quoted 14 lines · Sidharth Seela

Fix uninit errors caused after buffer allocation given to 'de'; by initializing the buffer with zeroes. The fix was found by using KMSAN.

Reported-by [email protected]
Fixes 78ab59fee07f2 ("fs/ntfs3: Rework file operations")

--

fs/ntfs3/inode.c +0 -0
index 37cbbee7fa58..6b14c13bda68 100644

fs/ntfs3/inode.c int ntfs_link_inode(struct inode *inode, struct dentry *dentry) · line 1722

Quoted 7 lines
fs/ntfs3/inode.c +1 -0
@@ -1716,6 +1716,7 @@ int ntfs_link_inode(struct inode *inode, struct dentry *dentry)
  	de = __getname();
  	if (!de)
  		return -ENOMEM;
+	memset(de, 0, PATH_MAX);
 
  	/* Mark rw ntfs as dirty. It will be cleared at umount. */
  	ntfs_set_state(sbi, NTFS_DIRTY_DIRTY);

Patch looks good — applied. Thanks.

Regards,
Konstantin