Skip to content

Commit 597f832

Browse files
dhowellsgregkh
authored andcommitted
netfs: Fix potential uninitialised var in netfs_extract_user_iter()
commit 7e3d8db upstream. 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: 85dd2c8 ("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent fc6eb39 commit 597f832

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/netfs/iterator.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ ssize_t netfs_extract_user_iter(struct iov_iter *orig, size_t orig_len,
4343
unsigned int max_pages;
4444
unsigned int npages = 0;
4545
unsigned int i;
46-
ssize_t ret;
46+
ssize_t ret = 0;
4747
size_t count = orig_len, offset, len;
4848
size_t bv_size, pg_size;
4949

0 commit comments

Comments
 (0)