[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202504071101.02539FE673@keescook>
Date: Mon, 7 Apr 2025 11:02:33 -0700
From: Kees Cook <kees@...nel.org>
To: Pierre-Louis Bossart <pierre-louis.bossart@...ux.dev>
Cc: Mark Brown <broonie@...nel.org>,
Ethan Carter Edwards <ethan@...ancedwards.com>,
Liam Girdwood <lgirdwood@...il.com>,
Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.com>,
linux-sound@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org,
Bard Liao <yung-chuan.liao@...ux.intel.com>, shumingf@...ltek.com
Subject: Re: [PATCH] ASoC: Intel: sof_sdw: initialize ret in
asoc_sdw_rt_amp_spk_rtd_init()
On Tue, Feb 11, 2025 at 12:54:52PM -0600, Pierre-Louis Bossart wrote:
> On 2/11/25 07:13, Mark Brown wrote:
> > On Mon, Feb 10, 2025 at 11:08:27PM -0500, Ethan Carter Edwards wrote:
> >> There is a possibility for an uninitialized *ret* variable to be
> >> returned in some code paths.
> >>
> >> Setting to 0 prevents a random value from being returned.
> >
> > That'll shut up the warning but is the warning trying to tell us that
> > there's a logic bug somewhere in the function and we're for example
> > forgetting to look at a return value in some path in the function?
>
> The problematic code is this:
>
> for_each_rtd_codec_dais(rtd, i, codec_dai) {
> if (strstr(codec_dai->component->name_prefix, "-1"))
> ret = snd_soc_dapm_add_routes(&card->dapm, rt_amp_map, 2);
> else if (strstr(codec_dai->component->name_prefix, "-2"))
> ret = snd_soc_dapm_add_routes(&card->dapm, rt_amp_map + 2, 2);
> }
>
> return ret;
>
> I am not sure if it's possible that either the for_each does nothing or that the two branches are skipped, but certainly initializing the 'ret' value makes sense to me.
>
> Bard, Shuming, what do you think?
I'm just skimming through patchwork and this patch doesn't seem to have
made any progress. What're next steps?
-Kees
--
Kees Cook
Powered by blists - more mailing lists