From patchwork Sat Nov 3 21:21:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 150094 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp926586ljp; Sat, 3 Nov 2018 14:22:04 -0700 (PDT) X-Google-Smtp-Source: AJdET5cqOV4ulddvb+rT8VexDFHEtZBcnfe4bdCDQaiVdfKoRvdodgFfljwqEklu582ELcr8KQy3 X-Received: by 2002:adf:826b:: with SMTP id 98-v6mr14726368wrb.312.1541280124349; Sat, 03 Nov 2018 14:22:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541280124; cv=none; d=google.com; s=arc-20160816; b=o2mLDVOpx6vYqj2RLzEX/P9AQJUtwesGf8IvYBa/j0R0mMNgp2FnMJGDWvUIOAZgF/ 63R7WU6V/nSdYRsSmAINdn4eqasYZy2R0hux0EfuPxgSzT15r3IcxsUGU8wL6A4zXQrP ytJifW4MVRZUubs4lfhd2Kg2lu4eQWhRtcUIJOQGwloHFkzGbFRVWPqaUV5urJ6vDW6R NKoWlTpiHu5eBAs7FrToUaboN8/0Px77nr7BGsX6DgcyZUuq0tIo+gQGwlJ4XGZ3YIqm A3yY0T/ifw3hvODG74glhMN+72zplyEuMYfKVJHJCM4r+pkj1lwTD4ZhUoV9Wccu+TBq nmTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:message-id:date:to:from:delivered-to; bh=ThQhW2kIvyBraBZPmpxBzJrOPK3z5ieN9c+SDod4DxQ=; b=nBBJD3eA1rSp7rsjrxEar7Fcy80W6Zp1oqP5kCqEFlnsp3LaewBmXemg2W7DDRbRyo W76Bwq/c3mmZ0p9P/HCePHeAiZenW5La1IUCp+v1A5jA6oDITu7OTl7pznT+RH8z4g/D ughn765Za/HK1ln6iSQ33t8SB/YzAWyc9f1UcVGCbtZ7XXUZ8KnhQSuDEiE4M4kvuIoh lzNBaMkPlwP0VNJS+tyxAY8l/u9t8zqqFp10WH4lzJ6bApaC8x2Y6uYmaqBOgPYpw/gA YSqsJTg4RKpzc5fJmj5Aa++MJjtrv37qRRDa7CBmKY617N6GVcAzMOdNOURTSEFp7eMV OUVQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id x13-v6si14385027wrt.114.2018.11.03.14.22.03; Sat, 03 Nov 2018 14:22:04 -0700 (PDT) Received-SPF: pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) client-ip=77.48.224.243; Authentication-Results: mx.google.com; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 60D62267950; Sat, 3 Nov 2018 22:22:01 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 07FE526795D; Sat, 3 Nov 2018 22:21:55 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2 autolearn=disabled version=3.4.0 Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.17.10]) by alsa0.perex.cz (Postfix) with ESMTP id 5EBEA267939 for ; Sat, 3 Nov 2018 22:21:52 +0100 (CET) Received: from wuerfel.lan ([109.192.41.194]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.145]) with ESMTPA (Nemesis) id 1Mk178-1fqdUU31mS-00kNkD; Sat, 03 Nov 2018 22:21:42 +0100 Received: from wuerfel.lan ([109.192.41.194]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.145]) with ESMTPA (Nemesis) id 1Mk178-1fqdUU31mS-00kNkD; Sat, 03 Nov 2018 22:21:42 +0100 From: Arnd Bergmann To: Pierre-Louis Bossart , Liam Girdwood , Jie Yang , Mark Brown Date: Sat, 3 Nov 2018 22:21:22 +0100 Message-Id: <20181103212140.890081-1-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 X-Provags-ID: V03:K1:Pk5aNWkpTapeDiotbwA0EVAWE9C4BExUYHaanHRQV7J5dt0G5Aa Uw0JKQi3PTBOqT/Y1D11E215GmanctkBSd3RluS7TwXhk0TwPV1TUJt3a5H6F6SELnL83jo zmUNtVk/yrK8zy0aL1G7715b06b7aVJN5bS274UzUDR7NOQxuBxnqhepVbNWGMyBmf2OvYl jp2T52TyFaNy/xNqxyDzA== X-UI-Out-Filterresults: notjunk:1; V01:K0:d2nEmYLaZpQ=:Gj38oqf5TV7f/AI5yFS5gy DDfQp7BTi8eRzG4gVQPfbRoD7lte0MYOYsLVyFb5NtwNGHFLfUPhrSRUpoG5SxA52TMrksZ30 f42F0wedgo+PApFzIrcqU5eWxj3QOkMLI2JihlTd+mxbbjiBAo4JIT7FN7ZUadrthQHX7ukND ZqNyCjxxfmGfeJfxTueVqU+X+RT0fRzjKjuec4UTeVadgj/lEBYnV/GcgzN4q2GigvABONu0E a6mfrRay1JKgxW4Wx2+FVOZbVQD7XLUzO0OJBSmvLhItz1ODKEpS44VBvWn7XWDfmIgX4N8c0 dQxCmJCktZJ57z1y8o9/oDLABbqIfuC1w/vyfdy8CcUPbUnjUQIneiw2RbA3I+7B5horbFrLp jg88t7ZD8hdMyYPeOUwqf8TRKZcNmz6GCdFuk8Tfas5FqclEipGzEnZPF6jLVJHmjVlOLXunl XLFOv8drNFlah2t4JD5znRQcPl5WhqXeT+UGeD2JJgw8cqdbpezWOG2iUlCHu8KpLcbXpB3Pf 3qURKDtR6Og0ZxHxL1uwlwXow3qOFF+gIvXzUAnDipvIkaau0krVM0PcqkEPxjBojttxn2YJO V/lYlpf6RXN3Qyb3SQaAMUp9AdbbWohExjGNIylJn/xKwIEw38bjQo1VtM28RGij4m80m/Q/V Z+zJAtnhsSeAUIn4GV/LJF48ezXxQe7iMuhBpDqI0bQcuLLriM15YErYUqS1EFnOg6R8ZY0CI 3nEW2vzzvXFkjxWxAKglpzkR3P3EPC9kGTORMy+6EXtlynZgDTQZMT9HC5E35hp5bYwyiSXHm UCVgtPp Cc: linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, Takashi Iwai , Arnd Bergmann Subject: [alsa-devel] [PATCH] ASoC: Intel: mrfld: fix uninitialized variable access X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org 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 --- sound/soc/intel/atom/sst/sst_loader.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.18.0 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel 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);