Skip to content

clk: adi: cdu: fix debugfs entry name buffer size - #3705

Merged
sipraga merged 1 commit into
adsp-6.18.31-yfrom
alvin/adsp/cdu/fix-w1-warning
Dec 4, 2026
Merged

sipraga merged 1 commit into
adsp-6.18.31-yfrom
alvin/adsp/cdu/fix-w1-warning

Conversation

@sipraga

@sipraga sipraga commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

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.

@sipraga
sipraga requested a review from qasim-ijaz December 3, 2026 15:32
Comment thread drivers/clk/adi/clk-adsp-cdu.c Outdated
{
struct adsp_cdu *cdu = to_adsp_cdu(clk_hw);
char debugfs_entry_name[12];
char debugfs_entry_name[sizeof("cdu_cfg[255]")];

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.

A bit odd! I would just give something like 32 or even 64 and be done with it, Anyways, not important

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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

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.

yea 32 should be fine imo

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
sipraga force-pushed the alvin/adsp/cdu/fix-w1-warning branch from a94ab5c to 656ea69 Compare December 4, 2026 09:51
@sipraga

sipraga commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

I made it 32

@sipraga
sipraga merged commit 02b80d7 into adsp-6.18.31-y Dec 4, 2026
19 checks passed
@sipraga
sipraga deleted the alvin/adsp/cdu/fix-w1-warning branch December 4, 2026 10:16
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.

3 participants