Skip to content

Commit 49dccfd

Browse files
committed
ASoC: SOF: ipc4-control: Use the correct size for scontrol->ipc_control_data
The size of the data behind scontrol->ipc_control_data is stored in scontrol->size, use this when copying data for backup/restore. Fixes: 03f5376 ("ASoC: sof: Improve sof_ipc4_bytes_ext_put function") Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
1 parent 91e7ba4 commit 49dccfd

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

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 */
@@ -567,15 +567,15 @@ static int sof_ipc4_bytes_ext_put(struct snd_sof_control *scontrol,
567567
if (!scontrol->old_ipc_control_data) {
568568
/* Create a backup of the current, valid bytes control */
569569
scontrol->old_ipc_control_data = kmemdup(scontrol->ipc_control_data,
570-
scontrol->max_size, GFP_KERNEL);
570+
scontrol->size, GFP_KERNEL);
571571
if (!scontrol->old_ipc_control_data)
572572
return -ENOMEM;
573573
}
574574

575575
/* Copy the whole binary data which includes the ABI header and the payload */
576576
if (copy_from_user(data, tlvd->tlv, header.length)) {
577577
memcpy(scontrol->ipc_control_data, scontrol->old_ipc_control_data,
578-
scontrol->max_size);
578+
scontrol->size);
579579
kfree(scontrol->old_ipc_control_data);
580580
scontrol->old_ipc_control_data = NULL;
581581
return -EFAULT;

0 commit comments

Comments
 (0)