Repository navigation
clk: adi: cdu: fix debugfs entry name buffer size - #3705
Merged
Merged
Conversation
nunojsa
approved these changes
Dec 3, 2026
| { | ||
| struct adsp_cdu *cdu = to_adsp_cdu(clk_hw); | ||
| char debugfs_entry_name[12]; | ||
| char debugfs_entry_name[sizeof("cdu_cfg[255]")]; |
Collaborator
There was a problem hiding this comment.
A bit odd! I would just give something like 32 or even 64 and be done with it, Anyways, not important
Contributor
Author
There was a problem hiding this comment.
yea some arbitrary number is also fine, just thought this was a bit more explicit
let's see what Qasim prefers since its his driver
qasim-ijaz
approved these changes
Dec 4, 2026
Building with W=1 shows this warning:
../drivers/clk/adi/clk-adsp-cdu.c: In function ‘adsp_cdu_debug_init’:
../drivers/clk/adi/clk-adsp-cdu.c:609:30: warning: ‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=]
609 | "cdu_cfg[%u]", cdu->cdu_clko);
| ^
../drivers/clk/adi/clk-adsp-cdu.c:608:9: note: ‘snprintf’ output between 11 and 13 bytes into a destination of size 12
608 | snprintf(debugfs_entry_name, sizeof(debugfs_entry_name),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
609 | "cdu_cfg[%u]", cdu->cdu_clko);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Since cdu->cdu_clko is a u8, %u can be up to 3 characters. Make the
buffer plenty bigger.
Signed-off-by: Alvin Šipraga <alvin.sipraga@analog.com>
sipraga
force-pushed
the
alvin/adsp/cdu/fix-w1-warning
branch
from
December 4, 2026 09:51
a94ab5c to
656ea69
Compare
Contributor
Author
|
I made it 32 |
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.
Building with W=1 shows this warning:
../drivers/clk/adi/clk-adsp-cdu.c: In function ‘adsp_cdu_debug_init’: ../drivers/clk/adi/clk-adsp-cdu.c:609:30: warning: ‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=]
609 | "cdu_cfg[%u]", cdu->cdu_clko);
| ^
../drivers/clk/adi/clk-adsp-cdu.c:608:9: note: ‘snprintf’ output between 11 and 13 bytes into a destination of size 12
608 | snprintf(debugfs_entry_name, sizeof(debugfs_entry_name),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
609 | "cdu_cfg[%u]", cdu->cdu_clko);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Since cdu->cdu_clko is a u8, %u can be up to 3 characters. Make the buffer bigger.