tplg_parser :Validate control name length #10361
Open
Biancaa-R wants to merge 2 commits intothesofproject:mainfrom
Open
tplg_parser :Validate control name length #10361Biancaa-R wants to merge 2 commits intothesofproject:mainfrom
Biancaa-R wants to merge 2 commits intothesofproject:mainfrom
Conversation
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>
Collaborator
|
Can one of the admins verify this patch?
|
Member
|
test this please |
lgirdwood
reviewed
Nov 11, 2025
Member
lgirdwood
left a comment
There was a problem hiding this comment.
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; | ||
| // } |
Member
There was a problem hiding this comment.
assume this will be an error message too when ready ?
|
|
||
| ctl_hdr = tplg_get(ctx); | ||
|
|
||
| #define MAX_CONTROL_NAME_LEN 64 |
Member
There was a problem hiding this comment.
I think this can be found in an ALSA header file.
Author
There was a problem hiding this comment.
@lgirdwood is this approach fine or should I change the test in any other better way?
Member
There was a problem hiding this comment.
You will need to #include the correct ALSA header file and use its macro for this size.
lyakh
reviewed
Nov 12, 2025
| 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: [FEATURE] tplg build should catch too long control names #9011
It doesnt break the build:
