Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp209497imj; Thu, 14 Feb 2019 18:45:34 -0800 (PST) X-Google-Smtp-Source: AHgI3IYoG0Ml5xdpGvE1piNBOrCghHLun14h3lmn9kgh/Un7unrsy8kIK+zm5aEUMLLuQvgoSvjG X-Received: by 2002:a62:2c4d:: with SMTP id s74mr7410018pfs.6.1550198733908; Thu, 14 Feb 2019 18:45:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550198733; cv=none; d=google.com; s=arc-20160816; b=hNiQCTa4fojhpGYgRkE4avYpDx3oCdWqb1zN46p/LA5kqVrbGyMymkYdtqOXRtmdqs g1GzC3JhQ/ptoiWh6yAC5luJuG5Zn8h/8xozEW+oe1xaj6x2m33MEizGD5fD6QZhVor2 bgPxXc873ufwn1ENS60Y5vIgv3DaKJUZUt88MBV1Ad6C+73GVHC1hNail46XoBkE6mE9 4XoQQA6YltJ6qYajmrQd032GaKLklvtcwgUv92OT+qoE55HG6grsqRBhKtS7qDg1PRID nZ1i/otSWwcpTFg3IjBG6JqnBjNsnmyY9gqIByMOqpvueQen6QB+sXmV07As0Nkbj4oz WybA== 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=XXWPSxpEJ/iRlE2QHb3e6nKRuybf0fr9cOy5S01mwBQ=; b=U9lnKGhLdThs2boX8r0K+dimydwAnxpkVq5CAxDeG9aVs4f24HRJ8ndddLrLRMidvt nkGZsKfQsjyTaXxSEwkcXMmPjJYRyC4zY+7JcJRXq+hx6WKbTbBqT0LSutpZkmrLVqUJ Hhk5WQPwHsRoHR3woo4nNYx5420A/kBkc6jhFdk0+1vo05yvBIYzf4VS0Cs6knkII0Pc xyU/a8pHdnTv7cspVD9lMl35X7ELNUuCDjIGNdjgQ/zRMTxlj1k7HILjZgJuWhPGF/rf 3Rylish3p4CaSQUEBj1MNtmgbBd9ogbJosXYVYmY7KR2m2Q3VxuXD9/4ijifWEIWJe+m Gs+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=T3tjaC+M; 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 b70si4111543pfe.168.2019.02.14.18.45.18; Thu, 14 Feb 2019 18:45:33 -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=T3tjaC+M; 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 S1729826AbfBOCnE (ORCPT + 99 others); Thu, 14 Feb 2019 21:43:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:49260 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731466AbfBOCJF (ORCPT ); Thu, 14 Feb 2019 21:09:05 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (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 0A2D42229F; Fri, 15 Feb 2019 02:09:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550196544; bh=fxe4q5n+2kystf5LYHWAuoFAxgwkFPIwrPDtiT+wbFI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T3tjaC+M5ul/aDTiEIk66QjjJADWr59d0LuB1oSCoQ9/sFwXkbMehaS8jkE0e7Ude f5kZtMW1bPSB5P3fddb3an8cabQjWcLu8F37QJopth+Js/iFyxl5AxGlqJdmNLPbjf 3IOAg+Ruor1qSTCUwpoFhRIGQ8OfwGnCs0TLzqHA= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Yizhuo , Mark Brown , Sasha Levin Subject: [PATCH AUTOSEL 4.20 05/77] ASoC: Variable "val" in function rt274_i2c_probe() could be uninitialized Date: Thu, 14 Feb 2019 21:07:43 -0500 Message-Id: <20190215020855.176727-5-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190215020855.176727-1-sashal@kernel.org> References: <20190215020855.176727-1-sashal@kernel.org> MIME-Version: 1.0 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: Yizhuo [ Upstream commit 8c3590de0a378c2449fc1aec127cc693632458e4 ] Inside function rt274_i2c_probe(), if regmap_read() function returns -EINVAL, then local variable "val" leaves uninitialized but used in if statement. This is potentially unsafe. Signed-off-by: Yizhuo Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/rt274.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/rt274.c b/sound/soc/codecs/rt274.c index 0ef966d56bac..e2855ab9a2c6 100644 --- a/sound/soc/codecs/rt274.c +++ b/sound/soc/codecs/rt274.c @@ -1128,8 +1128,11 @@ static int rt274_i2c_probe(struct i2c_client *i2c, return ret; } - regmap_read(rt274->regmap, + ret = regmap_read(rt274->regmap, RT274_GET_PARAM(AC_NODE_ROOT, AC_PAR_VENDOR_ID), &val); + if (ret) + return ret; + if (val != RT274_VENDOR_ID) { dev_err(&i2c->dev, "Device with ID register %#x is not rt274\n", val); -- 2.19.1