Re: [PATCH] drm/nouveau: replace snprintf() with scnprintf() in nvkm_snprintbf()

From: Danilo Krummrich
Date: Sat Aug 09 2025 - 08:00:32 EST


On 7/24/25 9:59 PM, Seyediman Seyedarab wrote:
snprintf() returns the number of characters that *would* have been
written, which can overestimate how much you actually wrote to the
buffer in case of truncation. That leads to 'data += this' advancing
the pointer past the end of the buffer and size going negative.

Switching to scnprintf() prevents potential buffer overflows and ensures
consistent behavior when building the output string.

Signed-off-by: Seyediman Seyedarab <ImanDevel@xxxxxxxxx>

Applied to drm-misc-next, thanks!