Re: [PATCH] staging: fbtft: prefer scnprintf over sprintf in fbtft-core.c

From: Dan Carpenter

Date: Wed Aug 19 2026 - 14:36:58 EST


On Wed, Aug 19, 2026 at 08:06:39PM +0300, Andy Shevchenko wrote:
> > (text1[50] and text2[50]) so the write is always bounded.
>
> > In practice an overflow is very unlikely here: text1 only needs
> > room for a size_t value from an SPI TX buffer length, and text2
> > formats three small integers (bus number, chip select, and
> > frequency in MHz) that always come from real hardware ranges far
> > below the theoretical worst case for their types. This is
> > therefore a defense-in-depth hardening rather than a fix for an
> > observed or easily triggered issue.
>
> This paragraph is not for the commit message, rather for the comment.
>

The paragraph describes the expected impact of the patch and it
belongs in the commit message. My problem is with it is that it's
1) Wrong because it says unlikely instead of impossible. And 2) goes
into too much unnecessary detail. We don't need to know where the
values come from since even the worst case for the type could fit.

regards,
dan carpenter