Skip to content

Commit 5f33da0

Browse files
Nirbhay Sharmaaalexandrovich
authored andcommitted
fs/ntfs3: fix KMSAN uninit-value in ni_create_attr_list
The call to kmalloc() to allocate the attribute list buffer is given a size of al_aligned(rs). This size can be larger than the data subsequently copied into the buffer, leaving trailing bytes uninitialized. This can trigger a KMSAN "uninit-value" warning if that memory is later accessed. Fix this by using kzalloc() instead, which ensures the entire allocated buffer is zero-initialized, preventing the warning. Reported-by: syzbot+83c9dd5c0dcf6184fdbf@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=83c9dd5c0dcf6184fdbf Signed-off-by: Nirbhay Sharma <nirbhay.lkd@gmail.com> Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
1 parent be99c62 commit 5f33da0

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/ntfs3/frecord.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ int ni_create_attr_list(struct ntfs_inode *ni)
767767
* Skip estimating exact memory requirement.
768768
* Looks like one record_size is always enough.
769769
*/
770-
le = kmalloc(al_aligned(rs), GFP_NOFS);
770+
le = kzalloc(al_aligned(rs), GFP_NOFS);
771771
if (!le)
772772
return -ENOMEM;
773773

0 commit comments

Comments
 (0)