]> git.ipfire.org Git - thirdparty/linux.git/commit
netfs: Fix potential uninitialised var in netfs_extract_user_iter()
authorDavid Howells <dhowells@redhat.com>
Tue, 12 May 2026 12:33:45 +0000 (13:33 +0100)
committerChristian Brauner <brauner@kernel.org>
Tue, 12 May 2026 12:42:30 +0000 (14:42 +0200)
commit7e3d8db899d54af39fafb2eb3392b0cdae9973b5
treea390830ea0429d8e8faabf1a6e62056f61f22f1e
parentdc7832d05deb4d632e8035e3299e31a3528fa0d0
netfs: Fix potential uninitialised var in netfs_extract_user_iter()

In netfs_extract_user_iter(), if it's given a zero-length iterator, it will
fall through the loop without setting ret, and so the error handling
behaviour will be undefined, depending on whether ret happens to be
negative.  The value of ret then propagates back up the callstack.

Fix this by presetting ret to 0.

Fixes: 85dd2c8ff368 ("netfs: Add a function to extract a UBUF or IOVEC into a BVEC iterator")
Closes: https://sashiko.dev/#/patchset/20260414082004.3756080-1-dhowells%40redhat.com
Signed-off-by: David Howells <dhowells@redhat.com>
Link: https://patch.msgid.link/20260512123404.719402-9-dhowells@redhat.com
cc: Paulo Alcantara <pc@manguebit.org>
cc: Matthew Wilcox <willy@infradead.org>
cc: netfs@lists.linux.dev
cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/netfs/iterator.c