diff options
| author | Harry Wentland <harry.wentland@amd.com> | 2026-06-16 13:39:21 -0400 |
|---|---|---|
| committer | Alex Deucher <alexander.deucher@amd.com> | 2026-09-10 12:52:59 -0400 |
| commit | 622b4e8505aa7453a53d17fa3a288871f270fc8b (patch) | |
| tree | caf5e988687554efbfc060d34cc445de8cfed25b /scripts/Makefile.thinlto | |
| parent | 87ceb8cba73d0b3c4025ff42495bccd8164acaed (diff) | |
| download | linux-622b4e8505aa7453a53d17fa3a288871f270fc8b.tar.gz linux-622b4e8505aa7453a53d17fa3a288871f270fc8b.zip | |
dm/amdgpu: fix malformed link_settings debugfs output
[Why]
dp_link_settings_read() passed strlen() of each format string as the size
argument to snprintf() and then advanced rd_buf_ptr by that same fixed amount.
The format-string length has no relation to the formatted output length, so
snprintf() truncated each field at a NUL it wrote inside the buffer while the
pointer was advanced past it. The result is a buffer peppered with embedded NUL
bytes and fields that are silently cut short, so the data read back from the
debugfs node does not reflect the actual link settings.
[How]
Use scnprintf() with the real remaining buffer size
(rd_buf_size - (rd_buf_ptr - rd_buf)) and advance rd_buf_ptr by its return
value, which is the number of characters actually written. This both bounds
each write to the space left in rd_buf and keeps the output a single,
properly terminated string. The now-unused str_len local is removed.
Fixes: 41db5f1931ec ("drm/amd/display: set-read link rate and lane count through debugfs")
Assisted-by: Copilot:claude-opus-4.8
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 43b9f0f18693c7f7b75613f3aeae25fa2b4e2f76)
Cc: stable@vger.kernel.org
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
