Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp773503ybc; Sat, 16 Nov 2019 08:26:27 -0800 (PST) X-Google-Smtp-Source: APXvYqyualvkhFJSDapsubQQOUe7aBZdlj1zb5pUniWHXu3ObfvuSNn3RGVcLB1q7qwEOm9o8c2r X-Received: by 2002:a17:906:2786:: with SMTP id j6mr10852059ejc.206.1573921587576; Sat, 16 Nov 2019 08:26:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573921587; cv=none; d=google.com; s=arc-20160816; b=OeUfGoI7jhThol0Umr7/XMksFZIHcw+KuuhW4faGQk2MSpTYuOq9l/LC02YYjSYRH8 nCKykpc0lOKJkyA22wBtdghpBHGJ2unamEYvlC5wGNNIC5nM+O7wxK5zpdysVsAgNm5s LPAnJS5SicXwK+tgM+yX1C3AwK5BKMQgv1zy4vPLea8Adw8NJSNrp0gNW0djsqiK0KtN hs4+cJy0rROCP5C46ihWdwzyO98mkW+Y7jzdKUwDLzh1d9Y6mNThYvSHtnPOtX45VZpW PJNUx6BiJ+SqTDHFJFZPKhoSLXjDnO03QxaOAZ7bwa0WTb5V5eFhhvdnJjjTHubM3/og fJ5Q== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cDSafAA6GynvxQiI05dYl1e2x0QMOuBcgyekeHMRPKQ=; b=k6bY2tXYloD6Fqjtv7EQ+oy6y0h+xIpSEt77fZZCc47ujsvVoFwHNM7QWLI4EmrZKj u6LMJ7r9fkEsf6WQ/iHTOGH6oX4plERX7vBF3zbQRqsE5ecO6lgtJ0xHIyGpYpdEJO75 ncmcqevmthRu4h1O+A00UoPcWGNkPRM82+LRrBYxbLSArpOPjTepvPMz+br1CD9Re5CX NMbOAPHe2YsOx6k5zDI7M5oZBG1XG8UZkMZimR9q/CDiIzAIUA1XLeWK08eCNfoF05wi JA8IO31eKlD6SzNOMsTgSxQvATLlKN6fFf4Tx2yra1lasnIF6PNtSZ5Xsh6x/IJFY6QL 7aXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hFR+Gcfo; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f7si7418046edc.217.2019.11.16.08.26.02; Sat, 16 Nov 2019 08:26:27 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=hFR+Gcfo; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729544AbfKPQVf (ORCPT + 99 others); Sat, 16 Nov 2019 11:21:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:47490 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728754AbfKPPnb (ORCPT ); Sat, 16 Nov 2019 10:43:31 -0500 Received: from sasha-vm.mshome.net (unknown [50.234.116.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3A5372082E; Sat, 16 Nov 2019 15:43:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573919010; bh=kvrgsIZ8Gymbi6c4WYY9shIxHq3UQvTGVVPm6yj3KAY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hFR+Gcfon30PiINYsSwpeLOzQbG21u3OMBhJDEUijVfpQ2OYhqtR1nYiDzM11JZei CDwbF+IUIWaeopifCJdO4KX6gBlvCXBDYGXIgwnLUqFJVcxaXCQ5Ih2OjjIKMBhTqg A7BQPGzIa+SRcmscVPG/qxXOtVRgNuCAzGY10JTA= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Garry McNulty , Steve French , Aurelien Aptel , Sasha Levin , linux-cifs@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 114/237] fs/cifs: fix uninitialised variable warnings Date: Sat, 16 Nov 2019 10:39:09 -0500 Message-Id: <20191116154113.7417-114-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191116154113.7417-1-sashal@kernel.org> References: <20191116154113.7417-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Garry McNulty [ Upstream commit ef2298a06d012973bbc592b86fe5ff730d4d0c63 ] In some error conditions, resp_buftype can be passed uninitialised to free_rsp_buf(), potentially resulting in a spurious debug message. If resp_buftype randomly had the value 1 (CIFS_SMALL_BUFFER) then this would log a debug message. The rsp pointer is initialised to NULL so there is no other side-effect. Detected by CoverityScan, CID 1438585 ("Uninitialized scalar variable") Detected by CoverityScan, CID 1438667 ("Uninitialized scalar variable") Detected by CoverityScan, CID 1438764 ("Uninitialized scalar variable") Signed-off-by: Garry McNulty Signed-off-by: Steve French Reviewed-by: Aurelien Aptel Signed-off-by: Sasha Levin --- fs/cifs/smb2pdu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index b1f5d0d28335a..9194f17675c89 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -2283,7 +2283,7 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path, struct cifs_ses *ses = tcon->ses; struct kvec iov[SMB2_CREATE_IOV_SIZE]; struct kvec rsp_iov = {NULL, 0}; - int resp_buftype; + int resp_buftype = CIFS_NO_BUFFER; int rc = 0; int flags = 0; @@ -2570,7 +2570,7 @@ SMB2_close_flags(const unsigned int xid, struct cifs_tcon *tcon, struct cifs_ses *ses = tcon->ses; struct kvec iov[1]; struct kvec rsp_iov; - int resp_buftype; + int resp_buftype = CIFS_NO_BUFFER; int rc = 0; cifs_dbg(FYI, "Close\n"); @@ -2723,7 +2723,7 @@ query_info(const unsigned int xid, struct cifs_tcon *tcon, struct kvec iov[1]; struct kvec rsp_iov; int rc = 0; - int resp_buftype; + int resp_buftype = CIFS_NO_BUFFER; struct cifs_ses *ses = tcon->ses; int flags = 0; -- 2.20.1