Skip to content
/ linux Public

Commit e1dd709

Browse files
ujfalusiSasha Levin
authored andcommitted
ASoC: SOF: ipc4-control: Use the correct size for scontrol->ipc_control_data
[ Upstream commit c1876fc ] The size of the data behind scontrol->ipc_control_data is stored in scontrol->size, use this when copying data for backup/restore. Fixes: db38d86 ("ASoC: sof: Improve sof_ipc4_bytes_ext_put function") Cc: stable@vger.kernel.org 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> Link: https://patch.msgid.link/20251217143945.2667-4-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 59fe643 commit e1dd709

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sound/soc/sof/ipc4-control.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ static int sof_ipc4_set_get_kcontrol_data(struct snd_sof_control *scontrol,
6666
* configuration
6767
*/
6868
memcpy(scontrol->ipc_control_data, scontrol->old_ipc_control_data,
69-
scontrol->max_size);
69+
scontrol->size);
7070
kfree(scontrol->old_ipc_control_data);
7171
scontrol->old_ipc_control_data = NULL;
7272
/* Send the last known good configuration to firmware */
@@ -519,15 +519,15 @@ static int sof_ipc4_bytes_ext_put(struct snd_sof_control *scontrol,
519519
if (!scontrol->old_ipc_control_data) {
520520
/* Create a backup of the current, valid bytes control */
521521
scontrol->old_ipc_control_data = kmemdup(scontrol->ipc_control_data,
522-
scontrol->max_size, GFP_KERNEL);
522+
scontrol->size, GFP_KERNEL);
523523
if (!scontrol->old_ipc_control_data)
524524
return -ENOMEM;
525525
}
526526

527527
/* Copy the whole binary data which includes the ABI header and the payload */
528528
if (copy_from_user(data, tlvd->tlv, header.length)) {
529529
memcpy(scontrol->ipc_control_data, scontrol->old_ipc_control_data,
530-
scontrol->max_size);
530+
scontrol->size);
531531
kfree(scontrol->old_ipc_control_data);
532532
scontrol->old_ipc_control_data = NULL;
533533
return -EFAULT;

0 commit comments

Comments
 (0)