Re: [PATCH v3] staging: greybus: audio: avoid snprintf truncation warnings
From: Dan Carpenter
Date: Mon Jan 05 2026 - 06:55:51 EST
This W=1 string truncation warnings always seems like a pointless thing.
dmesg output is really only intended for developers. I don't even know
how to look at the dmesg on my phone or kindle. Who cares if the last
character in a really long device name is missing? I have looked at a
lot of stack traces and I have never once been stymied because one
character was missing in a really long device name.
And also these are 90% false positives. We just add bounds checking all
of our output to prevent memory corruption and not because we think that
we'll actually hit the boundaries. And the GCC is not able to analyze
these in a sensible way, it's just going based on the variable types.
This patch makes the code worse (more complicated).
To recap:
1: It's warning about a non-issue. No one cares about truncated output.
2: The warning is implemented poorly. High false positive ratio.
3: The fix makes the code worse
Just fix the tool instead of making the code worse for no reason.
regards,
dan carpenter