Commit 7a1b4156 authored by Alexander Potapenko's avatar Alexander Potapenko Committed by sanglipeng
Browse files

fs: f2fs: initialize fsdata in pagecache_write()

stable inclusion
from stable-v5.10.173
commit 6be349d7388f3af7957dc6c7e241dc92a969fb38
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8BFR3

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=6be349d7388f3af7957dc6c7e241dc92a969fb38



--------------------------------

[ Upstream commit b1b98967 ]

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.

Suggested-by: default avatarEric Biggers <ebiggers@kernel.org>
Fixes: 95ae251f ("f2fs: add fs-verity support")
Signed-off-by: default avatarAlexander Potapenko <glider@google.com>
Reviewed-by: default avatarEric Biggers <ebiggers@google.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarsanglipeng <sanglipeng1@jd.com>
parent 223fd7d5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ static int pagecache_write(struct inode *inode, const void *buf, size_t count,
		size_t n = min_t(size_t, count,
				 PAGE_SIZE - offset_in_page(pos));
		struct page *page;
		void *fsdata;
		void *fsdata = NULL;
		int res;

		res = pagecache_write_begin(NULL, inode->i_mapping, pos, n, 0,