xfs: fix return of uninitialized value in variable error
authorColin Ian King <colin.king@canonical.com>
Fri, 9 Apr 2021 17:27:34 +0000 (10:27 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Fri, 9 Apr 2021 17:27:34 +0000 (10:27 -0700)
commit3b6dd9a9aeeada19d0c820ff68e979243a888bb6
tree8ff00b5de6e1979ee2f5566105024ca1893db41a
parent026f57ebe1beeae086f48c27cb0664cbb30cd955
xfs: fix return of uninitialized value in variable error

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>
fs/xfs/libxfs/xfs_attr.c