-
Notifications
You must be signed in to change notification settings - Fork 348
tplg_parser :Validate control name length #10361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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>
|
Can one of the admins verify this patch?
|
|
test this please |
lgirdwood
left a comment
There was a problem hiding this 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 !
| #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; | ||
| // } |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay .
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please fix indentation
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:
