Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1529334pxf; Fri, 9 Apr 2021 10:34:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1EN0lWzEhe6IfTSc29GQUIYPeW9tqsForzY7Wqo2bqxBTGo9ncG1cyOx37nb9GGbIsXXy X-Received: by 2002:a63:c741:: with SMTP id v1mr14109109pgg.207.1617989699468; Fri, 09 Apr 2021 10:34:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617989699; cv=none; d=google.com; s=arc-20160816; b=iYexSrDoixJbnKVJmRPNcE70jnGCMmEhixZYVygFkQu+HsZFl4XU5TiZIZJzdMe5hU OZJU1WjG/QbgIoyv5hK+0IIXV/K0SlgpYZsJlvhCIkm0Z39uOJ19Qo0JziY/5Hs4Fu90 GlggVf2szzk/Lqp2irYunvkcLYwhxlsUebw+/oPD5JSeDjZCY0Gwkn2wp2cryt2B7q89 CuvNi7IbBB7aEures5u65lij5oXeLCmRNxs3Yn2WvOgR4T7cKCkCxp2gtyJogajyZa1Y f64bZqyg5FUO72raGjnhxC1CM6mohjPP/3iQthcdMmbZm/yafFmng9VLspdcQa1NWFhj Z5Kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=nz42VROChN3uQQFfU+Yfk1ufi2xAZC0LhZ6JtzKD3nw=; b=jxn5jZLPzLYMsnBmPrza7ZMgjy593zlBVJe3ExEU4WmVB0GBnzlpRoawgHOzrFRcCT lX72hqHvu5Z7Wz3/W3yHMILORRuQgCwEQy32ELFoWvFgqcBPJPGK+288ahSz8fl4E1g6 zEPWt182X1QgDMtWoemCP64TmEVIcHl8rttCknqEIY3O33ZbjUEEN4qpQc0ahlswu9Hx 6Dby9yO7KTcVt8W65FRKFCDwehUZzW5BB226Ghrq/AQ3rI/JEt8cXpGMv2/LqbYDv+3u otLWblW5P6TeKrqVx6p+2JvWLhSSLw4nK23M8OIQKjUC5fJDUOc9Ct+tCYwTSrtL1PE1 XF5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fXe9VAV4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d4si3232774pfl.94.2021.04.09.10.34.46; Fri, 09 Apr 2021 10:34:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fXe9VAV4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234323AbhDIRcm (ORCPT + 99 others); Fri, 9 Apr 2021 13:32:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:38558 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234303AbhDIRcl (ORCPT ); Fri, 9 Apr 2021 13:32:41 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C498361041; Fri, 9 Apr 2021 17:32:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617989547; bh=DgQsAYz7C3D7+7i4uqL4JLN3BiyxKkj6rW+7gpCpDEQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fXe9VAV4uRHbLZLI5WLHd7Sn+uPzQV5zB/fClT1/RDm9lTmbav5+33prfPWqYRw9d uKo5F69X1l/o+MYMgBQjzldhJz0F5adse0aYJaQO09zVoiipObuMsBfL/nCxfnzNb9 m81XjCaL7TtwPCwcQRwGd4QKZAqk0e+f3xYMQn7XygHchZkHVkFPZesY5btZ+xvfM+ DLuDwCjbKLv9fJQV/apkFIca5YfI0qkg5i4I0pz/5j2EuOGJlL8U3JdEcuAR0d3X54 5PEvWM3aOCyDb8Rg90BdCx69cjY3lwR7Hc3oETJmZQ6gg6yDYNod8vlTKBHW8AbanT 2M3I6T61BTfgQ== Date: Fri, 9 Apr 2021 10:32:27 -0700 From: "Darrick J. Wong" To: Colin King Cc: linux-xfs@vger.kernel.org, Brian Foster , Dave Chinner , Allison Collins , Chandan Babu R , kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] xfs: fix return of uninitialized value in variable error Message-ID: <20210409173227.GH3957620@magnolia> References: <20210409141834.667163-1-colin.king@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210409141834.667163-1-colin.king@canonical.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 09, 2021 at 03:18:34PM +0100, Colin King wrote: > From: Colin Ian King > > 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 Looks correct to me... Reviewed-by: Darrick J. Wong --D > --- > fs/xfs/libxfs/xfs_attr.c | 1 + > 1 file changed, 1 insertion(+) > > 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 @@ xfs_attr_node_addname( > * 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; > -- > 2.30.2 >