affs: initialize fsdata in affs_truncate()
authorAlexander Potapenko <glider@google.com>
Tue, 10 Jan 2023 12:49:30 +0000 (13:49 +0100)
committerDavid Sterba <dsterba@suse.com>
Tue, 10 Jan 2023 13:55:20 +0000 (14:55 +0100)
When aops->write_begin() does not initialize fsdata, KMSAN may report
an error passing the latter to aops->write_end().

Fix this by unconditionally initializing fsdata.

Fixes: f2b6a16eb8f5 ("fs: affs convert to new aops")
Suggested-by: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Alexander Potapenko <glider@google.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/affs/file.c

index cefa222f7881c77560d51844ec3a8b7a6231462a..8daeed31e1af949a01beba514664f21725fdebda 100644 (file)
@@ -880,7 +880,7 @@ affs_truncate(struct inode *inode)
        if (inode->i_size > AFFS_I(inode)->mmu_private) {
                struct address_space *mapping = inode->i_mapping;
                struct page *page;
-               void *fsdata;
+               void *fsdata = NULL;
                loff_t isize = inode->i_size;
                int res;