diff mbox series

ASoC: SOF: ipc4-topology: Initialize in_format to NULL in sof_ipc4_get_audio_fmt

Message ID 20230317063524.8280-1-peter.ujfalusi@linux.intel.com (mailing list archive)
State Accepted
Commit ef51cd1ebab63bb92bfef050fbf12b2265f5c7a5
Headers show
Series ASoC: SOF: ipc4-topology: Initialize in_format to NULL in sof_ipc4_get_audio_fmt | expand

Commit Message

Peter Ujfalusi March 17, 2023, 6:35 a.m. UTC
If the available_fmt->num_input_formats is 0 and there is a failure during
the output format parsing then a kfree() would be called on the
uninitialized in_format pointer.

By initializing the in_format to NULL, this error can be avoided.

Fixes: 7ab6b1e8302c ("ASoC: SOF: ipc4-topology: Modify the type of available input/output formats")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
---
 sound/soc/sof/ipc4-topology.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Mark Brown March 17, 2023, 4:40 p.m. UTC | #1
On Fri, 17 Mar 2023 08:35:24 +0200, Peter Ujfalusi wrote:
> If the available_fmt->num_input_formats is 0 and there is a failure during
> the output format parsing then a kfree() would be called on the
> uninitialized in_format pointer.
> 
> By initializing the in_format to NULL, this error can be avoided.
> 
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: SOF: ipc4-topology: Initialize in_format to NULL in sof_ipc4_get_audio_fmt
      commit: ef51cd1ebab63bb92bfef050fbf12b2265f5c7a5

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
diff mbox series

Patch

diff --git a/sound/soc/sof/ipc4-topology.c b/sound/soc/sof/ipc4-topology.c
index e7b3bdc95dd7..2a2c4cda63fd 100644
--- a/sound/soc/sof/ipc4-topology.c
+++ b/sound/soc/sof/ipc4-topology.c
@@ -179,7 +179,8 @@  static int sof_ipc4_get_audio_fmt(struct snd_soc_component *scomp,
 				  struct sof_ipc4_available_audio_format *available_fmt,
 				  struct sof_ipc4_base_module_cfg *module_base_cfg)
 {
-	struct sof_ipc4_pin_format *out_format, *in_format;
+	struct sof_ipc4_pin_format *in_format = NULL;
+	struct sof_ipc4_pin_format *out_format;
 	int ret;
 
 	ret = sof_update_ipc_object(scomp, available_fmt,