From: Enchanted Hunter <enchantedredhunter@gmail.com>
To: gregkh@linuxfoundation.org
Cc: linux-staging@lists.linux.dev, andy@kernel.org,
dri-devel@lists.freedesktop.org
Subject: [PATCH] staging: fbtft: replace sprintf with snprintf
Date: Mon, 1 Jun 2026 03:43:55 +0300 [thread overview]
Message-ID: <CAOSULec2OpwTGB3OUb_n3CdKO6H_DGJnxw=qsBswbd+JBjemKA@mail.gmail.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 177 bytes --]
This patch replaces unsafe sprintf calls with snprintf
infbtft_register_framebuffer() to prevent potential buffer
overflow.Signed-off-by: rat1bor <enchantedredhunter@gmail.com>
[-- Attachment #1.2: Type: text/html, Size: 320 bytes --]
[-- Attachment #2: 0001-staging-fbtft-replace-sprintf-with-snprintf.patch --]
[-- Type: text/x-patch, Size: 1343 bytes --]
From a79c6098f2e8bb2ee9e276d339710522175db977 Mon Sep 17 00:00:00 2001
From: rat1bor <enchantedredhunter@gmail.com>
Date: Mon, 1 Jun 2026 03:18:59 +0300
Subject: [PATCH] staging: fbtft: replace sprintf with snprintf
Signed-off-by: rat1bor <enchantedredhunter@gmail.com>
---
drivers/staging/fbtft/fbtft-core.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
index ca0c38221c16..66509347255a 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -784,10 +784,11 @@ int fbtft_register_framebuffer(struct fb_info *fb_info)
fbtft_sysfs_init(par);
if (par->txbuf.buf && par->txbuf.len >= 1024)
- sprintf(text1, ", %zu KiB buffer memory", par->txbuf.len >> 10);
+ snprintf(text1, sizeof(text1), ", %zu KiB buffer memory", par->txbuf.len >> 10);
if (spi)
- sprintf(text2, ", spi%d.%d at %d MHz", spi->controller->bus_num,
- spi_get_chipselect(spi, 0), spi->max_speed_hz / 1000000);
+ snprintf(text2, sizeof(text2), ", spi%d.%d at %d MHz",
+ spi->controller->bus_num, spi_get_chipselect(spi, 0),
+ spi->max_speed_hz / 1000000);
fb_dbg(fb_info,
"%s frame buffer, %dx%d, %d KiB video memory%s, fps=%lu%s\n",
fb_info->fix.id, fb_info->var.xres, fb_info->var.yres,
--
2.34.1
next reply other threads:[~2026-06-01 7:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-01 0:43 Enchanted Hunter [this message]
2026-06-01 5:44 ` [PATCH] staging: fbtft: replace sprintf with snprintf Greg KH
2026-06-04 4:40 ` Claude review: " Claude Code Review Bot
2026-06-04 4:40 ` Claude Code Review Bot
2026-06-01 8:25 ` Andy Shevchenko
2026-06-02 17:12 ` Enchanted Hunter
2026-06-02 18:31 ` Andy Shevchenko
2026-06-02 19:33 ` Enchanted Hunter
2026-06-03 1:13 ` Andy Shevchenko
2026-06-03 9:14 ` Enchanted Hunter
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='CAOSULec2OpwTGB3OUb_n3CdKO6H_DGJnxw=qsBswbd+JBjemKA@mail.gmail.com' \
--to=enchantedredhunter@gmail.com \
--cc=andy@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=gregkh@linuxfoundation.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