summaryrefslogtreecommitdiff
path: root/fs/xfs
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2021-04-09 20:27:34 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-05-14 11:52:51 +0300
commit0d724bf90a2dceb249b9dfe01af3eb4501bfc8dd (patch)
treeb8f43742c4d37225a69675147927a90710cf4334 /fs/xfs
parent269c23fa1b8ef50434023d6c71883a04a093a11f (diff)
downloadlinux-0d724bf90a2dceb249b9dfe01af3eb4501bfc8dd.tar.xz
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: 07120f1abdff ("xfs: Add xfs_has_attr and subroutines") Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/libxfs/xfs_attr.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
index 472b3039eabb..902e5f7e6642 100644
--- a/fs/xfs/libxfs/xfs_attr.c
+++ b/fs/xfs/libxfs/xfs_attr.c
@@ -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;