Skip to content
Snippets Groups Projects
Commit 80cff3e1 authored by Colin Ian King's avatar Colin Ian King Committed by Greg Kroah-Hartman
Browse files

xfs: fix return of uninitialized value in variable error


[ Upstream commit 3b6dd9a9aeeada19d0c820ff68e979243a888bb6 ]

A previous commit removed a call to xfs_attr3_leaf_read that
assigned an error return code to variable error. We now have
a few early error return paths to label 'out' that return
error if error is set; however error now is uninitialized
so potentially garbage is being returned.  Fix this by setting
error to zero to restore the original behaviour where error
was zero at the label 'restart'.

Addresses-Coverity: ("Uninitialized scalar variable")
Fixes: 07120f1a ("xfs: Add xfs_has_attr and subroutines")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent b07520a5
No related branches found
No related tags found
No related merge requests found
......@@ -928,6 +928,7 @@ restart:
* Search to see if name already exists, and get back a pointer
* to where it should go.
*/
error = 0;
retval = xfs_attr_node_hasname(args, &state);
if (retval != -ENOATTR && retval != -EEXIST)
goto out;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment