Skip to content

ASoC: SOF: control: correct the copy size for bytes kcontrol put - #942

Merged
plbossart merged 1 commit into
thesofproject:topic/sof-devfrom
keyonjie:bytes-kcontrol
May 15, 2019
Merged

plbossart merged 1 commit into
thesofproject:topic/sof-devfrom
keyonjie:bytes-kcontrol

Conversation

@keyonjie

Copy link
Copy Markdown

The size for the bytes kcontrol should include the abi header, that is,
data->size + sizeof(*data), it is also aligned with get method after
this change.

Signed-off-by: Keyon Jie yang.jie@linux.intel.com

@plbossart plbossart left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch but fix needs an update, see below.

Comment thread sound/soc/sof/control.c Outdated

/* copy from kcontrol */
memcpy(data, ucontrol->value.bytes.data, data->size);
memcpy(data, ucontrol->value.bytes.data, data->size + sizeof(*data));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't look fully correct, the test at line 361 should be updated as well to match what is done for get?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@keyonjie this change seems OK.
But This API only supports up to 512 bytes max data size. We should be using the bytes_ext IO for all binary data. So I'd like to know what issue this change fixes.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't look fully correct, the test at line 361 should be updated as well to match what is done for get?

Make sense, let me correct it.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@keyonjie this change seems OK.
But This API only supports up to 512 bytes max data size. We should be using the bytes_ext IO for all binary data. So I'd like to know what issue this change fixes.

We are now using this API for test_detect component blob(smaller than 512, about 64 Bytes), we hit wrong bytes kcontrol put issue there.

You are correct, we will use bytes_ext for > 512B cases in other detector if needed.

The size for the bytes kcontrol should include the abi header, that is,
data->size + sizeof(*data), it is also aligned with get method after
this change.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>

@plbossart plbossart left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @keyonjie
Need another approver pronto.

@juimonen juimonen left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@keyonjie

Copy link
Copy Markdown
Author

@ranj063 can you please help cherry-pick this to cros-sof-v4.14-rebase also?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants