From: Markus Elfring <Markus.Elfring@web.de>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
kernel-janitors@vger.kernel.org, alsa-devel@alsa-project.org,
sound-open-firmware@alsa-project.org,
Bard Liao <yung-chuan.liao@linux.intel.com>,
Daniel Baluta <daniel.baluta@nxp.com>,
Jaroslav Kysela <perex@perex.cz>,
Kai Vehmanen <kai.vehmanen@linux.intel.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
Peter Ujfalusi <peter.ujfalusi@linux.intel.com>,
Rander Wang <rander.wang@intel.com>,
Ranjani Sridharan <ranjani.sridharan@linux.intel.com>,
Takashi Iwai <tiwai@suse.com>
Cc: cocci@inria.fr, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ASoC: SOF: Intel: hda-stream: Move three variable assignments behind condition checks in hda_dsp_iccmax_stream_hw_params()
Date: Mon, 24 Apr 2023 16:56:15 +0200 [thread overview]
Message-ID: <801aecdc-72ba-b3eb-dc7f-4399c088c60c@web.de> (raw)
In-Reply-To: <fbdee94e-b731-0471-e18f-b334ab0db7f5@linux.intel.com>
>> The address of a data structure member was determined before
>> a corresponding null pointer check in the implementation of
>> the function “hda_dsp_iccmax_stream_hw_params”.
>>
>> Thus avoid the risk for undefined behaviour by moving the assignment
>> for three local variables behind some condition checks.
>>
>> This issue was detected by using the Coccinelle software.
>>
>> Fixes: 7d88b9608142f95ccdd3dfb190da4a5faddb1cc7 ("ASoC: SOF: Intel: hdac_ext_stream: consistent prefixes for variables/members")
>> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
>
> Yes indeed, for some reason this was fixed in
> hda_dsp_stream_hw_params() but not in the
> hda_dsp_iccmax_stream_hw_params() variant.
Would Peter Ujfalusi like to support similar source code adjustments
also according to his commit 09255c7ed8ca1f1ed99357b845d2f63fe2ef3e1e
("ASoC: SOF: Intel: hda-stream: Do not dereference hstream until it is safe")
from 2023-04-04?
> Could we however use the same code as in hda_dsp_stream_hw_params() for consistency?
…
> hstream = &hext_stream->hstream;
> sd_offset = SOF_STREAM_SD_OFFSET(hstream);
> mask = BIT(hstream->index);
Can it matter to move such assignment statements a bit closer to subsequent statements?
Regards,
Markus
prev parent reply other threads:[~2023-04-24 14:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <40c60719-4bfe-b1a4-ead7-724b84637f55@web.de>
[not found] ` <1a11455f-ab57-dce0-1677-6beb8492a257@web.de>
2023-04-13 12:10 ` [PATCH] ASoC: SOF: topology: Move a variable assignment behind condition checks in sof_dai_load() Markus Elfring
2023-04-19 18:54 ` [PATCH] ASoC: SOF: Intel: hda-stream: Move three variable assignments behind condition checks in hda_dsp_iccmax_stream_hw_params() Markus Elfring
2023-04-19 19:03 ` Pierre-Louis Bossart
2023-04-24 14:56 ` Markus Elfring [this message]
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=801aecdc-72ba-b3eb-dc7f-4399c088c60c@web.de \
--to=markus.elfring@web.de \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=cocci@inria.fr \
--cc=daniel.baluta@nxp.com \
--cc=kai.vehmanen@linux.intel.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=peter.ujfalusi@linux.intel.com \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=rander.wang@intel.com \
--cc=ranjani.sridharan@linux.intel.com \
--cc=sound-open-firmware@alsa-project.org \
--cc=tiwai@suse.com \
--cc=yung-chuan.liao@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