All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
To: lgirdwood@gmail.com, broonie@kernel.org
Cc: linux-sound@vger.kernel.org, kai.vehmanen@linux.intel.com,
	ranjani.sridharan@linux.intel.com,
	yung-chuan.liao@linux.intel.com, pierre-louis.bossart@linux.dev,
	seppo.ingalsuo@linux.intel.com
Subject: [PATCH 3/8] ASoC: SOF: ipc4-control: Use the correct size for scontrol->ipc_control_data
Date: Mon, 15 Dec 2025 13:20:43 +0200	[thread overview]
Message-ID: <20251215112048.16331-4-peter.ujfalusi@linux.intel.com> (raw)
In-Reply-To: <20251215112048.16331-1-peter.ujfalusi@linux.intel.com>

The size of the data behind scontrol->ipc_control_data is stored in
scontrol->size, use this when copying data for backup/restore.

Fixes: 03f537690f40 ("ASoC: sof: Improve sof_ipc4_bytes_ext_put function")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
---
 sound/soc/sof/ipc4-control.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/soc/sof/ipc4-control.c b/sound/soc/sof/ipc4-control.c
index 0a05f66ec7d9..80111672c179 100644
--- a/sound/soc/sof/ipc4-control.c
+++ b/sound/soc/sof/ipc4-control.c
@@ -66,7 +66,7 @@ static int sof_ipc4_set_get_kcontrol_data(struct snd_sof_control *scontrol,
 		 * configuration
 		 */
 		memcpy(scontrol->ipc_control_data, scontrol->old_ipc_control_data,
-		       scontrol->max_size);
+		       scontrol->size);
 		kfree(scontrol->old_ipc_control_data);
 		scontrol->old_ipc_control_data = NULL;
 		/* Send the last known good configuration to firmware */
@@ -567,7 +567,7 @@ static int sof_ipc4_bytes_ext_put(struct snd_sof_control *scontrol,
 	if (!scontrol->old_ipc_control_data) {
 		/* Create a backup of the current, valid bytes control */
 		scontrol->old_ipc_control_data = kmemdup(scontrol->ipc_control_data,
-							 scontrol->max_size, GFP_KERNEL);
+							 scontrol->size, GFP_KERNEL);
 		if (!scontrol->old_ipc_control_data)
 			return -ENOMEM;
 	}
@@ -575,7 +575,7 @@ static int sof_ipc4_bytes_ext_put(struct snd_sof_control *scontrol,
 	/* Copy the whole binary data which includes the ABI header and the payload */
 	if (copy_from_user(data, tlvd->tlv, header.length)) {
 		memcpy(scontrol->ipc_control_data, scontrol->old_ipc_control_data,
-		       scontrol->max_size);
+		       scontrol->size);
 		kfree(scontrol->old_ipc_control_data);
 		scontrol->old_ipc_control_data = NULL;
 		return -EFAULT;
-- 
2.52.0


  parent reply	other threads:[~2025-12-15 11:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-15 11:20 [PATCH 0/8] ASoC: SOF: ipoc4: Support for generic bytes controls Peter Ujfalusi
2025-12-15 11:20 ` [PATCH 1/8] ASoC: SOF: ipc4-control: If there is no data do not send bytes update Peter Ujfalusi
2025-12-15 11:20 ` [PATCH 2/8] ASoC: SOF: ipc4-topology: Correct the allocation size for bytes controls Peter Ujfalusi
2025-12-15 14:12   ` Mark Brown
2025-12-15 11:20 ` Peter Ujfalusi [this message]
2025-12-15 11:20 ` [PATCH 4/8] ASoC: SOF: ipc4-control: Keep the payload size up to date Peter Ujfalusi
2025-12-15 11:20 ` [PATCH 5/8] ASoC: SOF: ipc4-topology: Set initial param_id for bytes control type Peter Ujfalusi
2025-12-15 11:20 ` [PATCH 6/8] ASoC: SOF: ipc4: Support for sending payload along with LARGE_CONFIG_GET Peter Ujfalusi
2025-12-15 11:20 ` [PATCH 7/8] ASoC: SOF: ipc4: Add definition for generic bytes control Peter Ujfalusi
2025-12-15 11:20 ` [PATCH 8/8] ASoC: SOF: ipc4-control: Add support " Peter Ujfalusi
2025-12-23 17:07 ` [PATCH 0/8] ASoC: SOF: ipoc4: Support for generic bytes controls 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=20251215112048.16331-4-peter.ujfalusi@linux.intel.com \
    --to=peter.ujfalusi@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-sound@vger.kernel.org \
    --cc=pierre-louis.bossart@linux.dev \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=seppo.ingalsuo@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.