From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Arnd Bergmann <arnd@arndb.de>,
Liam Girdwood <liam.r.girdwood@linux.intel.com>,
Jie Yang <yang.jie@linux.intel.com>,
Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: Re: [alsa-devel] [PATCH] ASoC: Intel: mrfld: fix uninitialized variable access
Date: Sun, 4 Nov 2018 09:10:13 -0600 [thread overview]
Message-ID: <f14b9bda-47d9-cb3a-b881-0a8058a0f59c@linux.intel.com> (raw)
In-Reply-To: <20181103212140.890081-1-arnd@arndb.de>
On 11/3/18 4:21 PM, Arnd Bergmann wrote:
> 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.
yes indeed, good catch.
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
>
> Fixes: 9012c9544eea ("ASoC: Intel: mrfld - Add DSP load and management")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> 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);
next prev parent reply other threads:[~2018-11-04 15:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-03 21:21 Arnd Bergmann
2018-11-04 15:10 ` Pierre-Louis Bossart [this message]
2018-11-05 11:58 ` Applied "ASoC: Intel: mrfld: fix uninitialized variable access" to the asoc tree Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f14b9bda-47d9-cb3a-b881-0a8058a0f59c@linux.intel.com \
--to=pierre-louis.bossart@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=arnd@arndb.de \
--cc=broonie@kernel.org \
--cc=liam.r.girdwood@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
--cc=yang.jie@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®