]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
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)
committerKelsey Skunberg <kelsey.skunberg@canonical.com>
Mon, 24 May 2021 23:46:36 +0000 (17:46 -0600)
BugLink: https://bugs.launchpad.net/bugs/1929455
[ 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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
fs/xfs/libxfs/xfs_attr.c

index fd8e6418a0d312812a2fc332f851585abcdeb4f9..96ac7e562b87136146cc0a0eab6f7605477e1b7a 100644 (file)
@@ -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;