Skip to content

Conversation

@Biancaa-R
Copy link

Adds build-time validation to ensure control and widget names
do not exceed maximum allowed length, preventing kernel load
errors for topologies with overly long names.

  • Still in progress
image

It doesnt break the build:
image

image

Biancaa Ramesh and others added 2 commits November 11, 2025 03:22
Adds build-time validation to ensure control and widget names
do not exceed maximum allowed length, preventing kernel load
errors for topologies with overly long names.

Fixes: thesofproject#9011
Signed-off-by: Biancaa Ramesh <biancaa2210329@ssn.edu.in>
@sofci
Copy link
Collaborator

sofci commented Nov 10, 2025

Can one of the admins verify this patch?

reply test this please to run this test once

@lgirdwood
Copy link
Member

test this please

Copy link
Member

@lgirdwood lgirdwood left a comment

Choose a reason for hiding this comment

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

No need for the merge commit btw, you can rebase on top of main to get rid of it. Thanks !

Comment on lines +103 to +107
#define MAX_CONTROL_NAME_LEN 64
// if (strlen(ctl_hdr->name) > MAX_CONTROL_NAME_LEN) {
// fprintf(stderr, "error: control name too long: %s\n", ctl_hdr->name);
// return -EINVAL;
// }
Copy link
Member

Choose a reason for hiding this comment

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

assume this will be an error message too when ready ?


ctl_hdr = tplg_get(ctx);

#define MAX_CONTROL_NAME_LEN 64
Copy link
Member

Choose a reason for hiding this comment

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

I think this can be found in an ALSA header file.

Copy link
Author

Choose a reason for hiding this comment

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

Okay .

Copy link
Author

Choose a reason for hiding this comment

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

@lgirdwood is this approach fine or should I change the test in any other better way?

Copy link
Member

Choose a reason for hiding this comment

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

You will need to #include the correct ALSA header file and use its macro for this size.

mixer_ctl = (struct snd_soc_tplg_mixer_control *)ctl_hdr;
if (strlen(mixer_ctl->name) > MAX_CONTROL_NAME_LEN) {
fprintf(stderr, "error: control name too long: %s\n", mixer_ctl->name);
return -EINVAL;
Copy link
Collaborator

Choose a reason for hiding this comment

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

please fix indentation

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.

[FEATURE] tplg build should catch too long control names

4 participants