Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1553927ybl; Wed, 28 Aug 2019 17:02:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqyDH3qtWh1dTfOwojUdo4ElqvDKV0kUlNSEQnHXVGNwnNBF1PzXFtTIN5AQUGIWKck0Z5Yw X-Received: by 2002:aa7:8ac5:: with SMTP id b5mr7582450pfd.56.1567036927231; Wed, 28 Aug 2019 17:02:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567036927; cv=none; d=google.com; s=arc-20160816; b=otFB+ZOVvqsVkRvzNorGXdVx8a8PSaCD7bezwIYxYj8+xcreRLok5wtaVhG6sSvhqX /PJN2XK6jFYovWT0uoI9ccGpBmjl1xFAKlSYiMvtZCSikuqs66hZ6yYLVkC0ZyOIBXTZ vSy79NFjg85ZMGY7Wb8DtOOweGyacpD/YAr5d6ERULDbnC3kIubq2y+nsMWbgMTsHvQx Qlg1rXjPyWSmLbAVlf52Ra+pRPyUuAEzI6u3zFcI7UZKFvfon/yJ119Fi4DzX3MQgoNJ /LhFv4Xp+sHPNHCM0Bq9cXpztP+JaKulH2+DxHLFDB+iknbrrDMFxnoNrUQYs+8KRdya Drjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=UHbf7h8VsQFoZRduQkij3pH78iYg6QKziLiHOwXEEjk=; b=AcBJtbluuFPUXgQL7tWO60neyLqPK2AWssh8wWjUswu9qpEwimWexd4Vzl8niHNOWM 75m7JtcgQr9hcJ6QIVTSpL9+Hf0+Bc87YTmvx11AcRVCgJSc9QttbWPOCc1tWNzbAc5q K3vEGDLpOLJNjaMaLtcBbHFUgtuGo07LMVZXgHeCsKckFTYWekMwjyclgDS7bDZ1ymal T5VqLPD7ijuVkM+ha7Rbs0uBD7m0pW82xfQ1C4ZSWcKMW6FIkY8ZYuAR9jrGWwElgWuE GGaE2DOGCGjRrdzmJuUhyMIotux3SvU38XJMfMZMQpIj2JPLBZjOouaTJH9+ZTH1IrQe Qovw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id bh10si397931plb.76.2019.08.28.17.01.34; Wed, 28 Aug 2019 17:02:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1726983AbfH2AAJ (ORCPT + 99 others); Wed, 28 Aug 2019 20:00:09 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:58253 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726825AbfH2AAJ (ORCPT ); Wed, 28 Aug 2019 20:00:09 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1i37rD-00059z-4t; Thu, 29 Aug 2019 00:00:07 +0000 From: Colin King To: Steve French , linux-cifs@vger.kernel.org, samba-technical@lists.samba.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][cifs-next] cifs: ensure variable rc is initialized at the after_open label Date: Thu, 29 Aug 2019 01:00:06 +0100 Message-Id: <20190829000006.24187-1-colin.king@canonical.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King A previous fix added a jump to after_open which now leaves variable rc in a uninitialized state. A couple of the cases in the following switch statement do not set variable rc, hence the error check on rc at the end of the switch statement is reading a garbage value in rc for those specific cases. Fix this by initializing rc to zero before the switch statement. Fixes: 955a9c5b39379 ("cifs: create a helper to find a writeable handle by path name") Addresses-Coverity: ("Uninitialized scalar variable") Signed-off-by: Colin Ian King --- fs/cifs/smb2inode.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/cifs/smb2inode.c b/fs/cifs/smb2inode.c index 70342bcd89b4..939fc7b2234c 100644 --- a/fs/cifs/smb2inode.c +++ b/fs/cifs/smb2inode.c @@ -116,6 +116,7 @@ smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon, smb2_set_next_command(tcon, &rqst[num_rqst]); after_open: num_rqst++; + rc = 0; /* Operation */ switch (command) { -- 2.20.1