Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1391870pxf; Fri, 9 Apr 2021 07:21:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwiTRBrBWmUr9OhPkR1KlN1nhGTj6Xm5MDa3nf8Rr4Ox2sUUFljCcMXqbbVUUWww5UAoCB2 X-Received: by 2002:a50:85cd:: with SMTP id q13mr18065859edh.114.1617978070402; Fri, 09 Apr 2021 07:21:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617978070; cv=none; d=google.com; s=arc-20160816; b=A2tGATufv96p3d4XS1ZkOGaWcDNV+6TlpaVIBbf7VVp/DOpzJkhwQoyX9N6wExbulr 9em7HYo+6klyIW10nYPiqVGBlOVKKQBVgMxxrV5FEas9zpbgtqRKRday+VgsaLltHIcE f443gdHmJMl14JATYiVKj8wKE2PhPwsjX6eg6R8Yiqs05naTx0M1cKfQXAztjnLuWRYl nXTPeLqBOV+jyp1uyuFK9cyb/AU9r7jOfWcBAMpS8nQGw/0bXCfvlxNmSTQoG7n5hilJ kP0LbF6vJ4dDi0T3GFpPNWwn/jSNSCqBtot4+VuOsuYanAsRGvnOm6tuKTuDDqY+PjCW spVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=BptXuzgBeeHpxPNwQ2d2R+QDBK0XvPRr9V0XZnt0ZPw=; b=cX2IoZjCxnutZ3A5RXZG05QbVn9dosZWgHiHr43k3Z6Z1ueRH+d5XH5iOQzyRN0wAc cBd6xDydAlyvTB/EpHYuxhKJ01TAlJx7OK0cT4Y0opab4g1JeaJXdJnm2PIjPFu1uQvP YIoyb69Smt5fwfz6Wn8Z+NLLQp6AhCyc0VH68TDbdkHcKB1XkkpArVPNWSOej3Aca600 AKKeEl1o+n58ej039vd39ZOB/05zWaN0ftNlvnCx86oegLyAwgqzBTltLrG4sssjv7YR XtR0wDitDFFGii+8dvTe8hI90rmurXFj+n+cbxTEqLWq1YVknfwdToW3d3lwbABAGaee dtKw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a5si2029926ejt.533.2021.04.09.07.20.47; Fri, 09 Apr 2021 07:21:10 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233019AbhDIOSt (ORCPT + 99 others); Fri, 9 Apr 2021 10:18:49 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:48411 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231402AbhDIOSs (ORCPT ); Fri, 9 Apr 2021 10:18:48 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lUrxy-0004mK-8f; Fri, 09 Apr 2021 14:18:34 +0000 From: Colin King To: "Darrick J . Wong" , linux-xfs@vger.kernel.org, Brian Foster , Dave Chinner , Allison Collins , Chandan Babu R Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] xfs: fix return of uninitialized value in variable error Date: Fri, 9 Apr 2021 15:18:34 +0100 Message-Id: <20210409141834.667163-1-colin.king@canonical.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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