From: Tomasz Unger <tomasz.unger@yahoo.pl>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: Andy Shevchenko <andy@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"linux-fbdev@vger.kernel.org" <linux-fbdev@vger.kernel.org>,
"linux-staging@lists.linux.dev" <linux-staging@lists.linux.dev>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Dan Carpenter <error27@gmail.com>
Subject: Re: [PATCH v2] staging: fbtft: prefer snprintf over sprintf in fbtft-core.c
Date: Wed, 26 Aug 2026 19:01:07 +0000 (UTC) [thread overview]
Message-ID: <288624768.4518972.1787770867491@mail.yahoo.com> (raw)
In-Reply-To: <aowH8YrNTzAJYRa9@ashevche-desk.local>
[-- Attachment #1: Type: text/plain, Size: 1350 bytes --]
Correct - no compiler or static analysis tool flags this. The overflow is mathematically impossible for these argument types, so the patch doesn't fix an actual bug.
I addressed Dan's specific wording feedback but missed responding to your core objection about the patch being unnecessary. Given the above, I'll drop this patch unless you see value in keeping it as a documented safety margin.
Regards,
Tomasz Unger
W poniedziałek, 24 sierpnia 2026 10:59:40 CEST, Andy Shevchenko <andriy.shevchenko@intel.com> napisał(-a):
On Thu, Aug 20, 2026 at 06:58:12PM +0200, Tomasz Unger wrote:
> Using sprintf has potential for buffer overflows if the formatted
sprintf()
> string exceeds the destination buffer size. Replace it with
> snprintf, passing sizeof() of the fixed-size stack buffers
snprintf()
> (text1[50] and text2[50]) so the write is always bounded.
>
> An overflow is impossible here: even the worst case for the
> argument types (size_t for text1, three ints for text2) still
> fits within 50 bytes. Use snprintf() rather than scnprintf()
> since the return value is not used here.
Then why the patch is needed at all? Do you have any compiler that warns
you about something?
...
It looks like you ignored all my comments against v1...
--
With Best Regards,
Andy Shevchenko
[-- Attachment #2: Type: text/html, Size: 2152 bytes --]
prev parent reply other threads:[~2026-08-27 9:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260820-fbtft-v2-final-v2-1-44d107b04634.ref@yahoo.pl>
2026-08-20 16:58 ` [PATCH v2] staging: fbtft: prefer snprintf over sprintf in fbtft-core.c Tomasz Unger
2026-08-20 17:07 ` sashiko-bot
2026-08-24 8:59 ` Andy Shevchenko
2026-08-26 19:01 ` Tomasz Unger [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=288624768.4518972.1787770867491@mail.yahoo.com \
--to=tomasz.unger@yahoo.pl \
--cc=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=error27@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox