public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] staging: fbtft: replace sprintf with snprintf
@ 2026-06-01  0:43 Enchanted Hunter
  2026-06-01  5:44 ` Greg KH
  2026-06-01  8:25 ` Andy Shevchenko
  0 siblings, 2 replies; 10+ messages in thread
From: Enchanted Hunter @ 2026-06-01  0:43 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, andy, dri-devel


[-- 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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-06-04  4:40 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-01  0:43 [PATCH] staging: fbtft: replace sprintf with snprintf Enchanted Hunter
2026-06-01  5:44 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox