Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3715439imu; Mon, 28 Jan 2019 09:31:14 -0800 (PST) X-Google-Smtp-Source: ALg8bN6lHvU/hfCEZRWNK+tstILUOE5JgAXcG57a6apTpe9RW663ZcyaW2QLhnwhh2UenH40IcBu X-Received: by 2002:a65:6242:: with SMTP id q2mr20767221pgv.245.1548696674489; Mon, 28 Jan 2019 09:31:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548696674; cv=none; d=google.com; s=arc-20160816; b=haYkUHlG++b8MlEea5383TWQUA8gRNuH+tmN0XBwGlVjVH2DapkeHtMQvam0LUFLie S9lGPZq8C0jzT6lEhUCaMIuCBD6L92Xs0yyvJsc2GSX+C1c7BPaQjdxbpRp2zwevGXP3 QDV1/Ylh8lRyg/2PU5cmXyLSO6bjOIGC7DG7s8xu2CptvPSq34usrXRk8+cpn85hwFR/ uWEMYXsjpdzzbnJeXtMO9Qs5ykgN9cdlcMVJtNPWUCYB2E2ILmWOjKMSEaCjFw2b5szt xzzp7gYEQ4k1gCjIhHPnP2Cpg6dBropTbve+1GRgqMUswcnj4huXZlp7TzI/uWUuM6hN jvWA== 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=4lBv41df5t7hgZz6lvoZFKYb9v8PwHX7B+F7x0Q5aRQ=; b=lop2aqdn5Tt629wwv3QsfYv/v7Tl4bcv93hZvfbZwyTEfoNzmBg0hv2XPJAURUiUez Tzk0kvoM788LrWRlwHtZQ+736GOxq7Z6hzlSy7HV7eWM2557IC3hIvFgpI4nvgPgl5h2 zypmSl8wL96QAut5HtQ2Qxxa6Zv386Ezz+FuprRcPL9nqYSHfiBOVzUDu+LOp3CCzwhB gGNe7MRJ5PqjTnNTTCscKAuaM7e6foPAcvM4yxgwz/iZ9tt5PO3zN7YHKTdzuC+z0k10 W8RahGioRCV+AUDwj9drxuZe1ZkxcdaVeAbzCWWv42FMHtWT7EQj5VLuuFTDloD7BErL vdGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Di9IrLSv; 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 39si34315627pla.352.2019.01.28.09.30.59; Mon, 28 Jan 2019 09:31:14 -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=Di9IrLSv; 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 S1730612AbfA1P7p (ORCPT + 99 others); Mon, 28 Jan 2019 10:59:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:44970 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730022AbfA1P7n (ORCPT ); Mon, 28 Jan 2019 10:59:43 -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 E9F4221848; Mon, 28 Jan 2019 15:59:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691183; bh=9cbfAIXOFbbajhdQueuYHjcFXVaN7mUO0Htati8+Ipc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Di9IrLSvKjIck8gNJQx6NP1p3VBRv30PEJoxhNZEV773qUYWkM/YnWNL+vow0iLkT Zfh5sjiM176gb7ANxBUenUQEgp7Gkf3dEEZFqz9p2YU9aKvnMxlppdtQXNb91XuwKK EBYSrDgqvrNn0Im6/EA2bXwqniPhEP45m4InDX5s= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Arnd Bergmann , Mark Brown , Sasha Levin Subject: [PATCH AUTOSEL 4.19 005/258] ASoC: Intel: mrfld: fix uninitialized variable access Date: Mon, 28 Jan 2019 10:55:11 -0500 Message-Id: <20190128155924.51521-5-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128155924.51521-1-sashal@kernel.org> References: <20190128155924.51521-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: Arnd Bergmann [ Upstream commit 1539c7f23f256120f89f8b9ec53160790bce9ed2 ] Randconfig testing revealed a very old bug, with gcc-8: sound/soc/intel/atom/sst/sst_loader.c: In function 'sst_load_fw': sound/soc/intel/atom/sst/sst_loader.c:357:5: error: 'fw' may be used uninitialized in this function [-Werror=maybe-uninitialized] if (fw == NULL) { ^ sound/soc/intel/atom/sst/sst_loader.c:354:25: note: 'fw' was declared here const struct firmware *fw; We must check the return code of request_firmware() before we look at the pointer result that may be uninitialized when the function fails. Fixes: 9012c9544eea ("ASoC: Intel: mrfld - Add DSP load and management") Signed-off-by: Arnd Bergmann Acked-by: Pierre-Louis Bossart Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/intel/atom/sst/sst_loader.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sound/soc/intel/atom/sst/sst_loader.c b/sound/soc/intel/atom/sst/sst_loader.c index 27413ebae956..b8c456753f01 100644 --- a/sound/soc/intel/atom/sst/sst_loader.c +++ b/sound/soc/intel/atom/sst/sst_loader.c @@ -354,14 +354,14 @@ static int sst_request_fw(struct intel_sst_drv *sst) const struct firmware *fw; retval = request_firmware(&fw, sst->firmware_name, sst->dev); - if (fw == NULL) { - dev_err(sst->dev, "fw is returning as null\n"); - return -EINVAL; - } if (retval) { dev_err(sst->dev, "request fw failed %d\n", retval); return retval; } + if (fw == NULL) { + dev_err(sst->dev, "fw is returning as null\n"); + return -EINVAL; + } mutex_lock(&sst->sst_lock); retval = sst_cache_and_parse_fw(sst, fw); mutex_unlock(&sst->sst_lock); -- 2.19.1