mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] x86/hpet: Replace sprintf() with scnprintf() in hpet_select_clockevents()
@ 2026-11-17 11:39 Habil Eren Türker
  2026-11-19 23:04 ` Edgecombe, Rick P
  0 siblings, 1 reply; 5+ messages in thread
From: Habil Eren Türker @ 2026-11-17 11:39 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	H. Peter Anvin, Jiri Wiesner, Daniel J Blueman,
	Habil Eren Türker, linux-kernel

Replace the deprecated sprintf() call with scnprintf() when formatting
the per-CPU HPET channel name into the 10-byte hc->name buffer.
Using scnprintf() ensures null-termination while avoiding
-Wformat-truncation warnings for the unsigned int channel index.

Signed-off-by: Habil Eren Türker <habilerenturker@hotmail.com>
---
 arch/x86/kernel/hpet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index 8dc7b710e125..0edf0fe0ac2b 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -722,7 +722,7 @@ static void __init hpet_select_clockevents(void)
 		if (!(hc->boot_cfg & HPET_TN_FSB_CAP))
 			continue;
 
-		sprintf(hc->name, "hpet%d", i);
+		scnprintf(hc->name, sizeof(hc->name), "hpet%u", i);
 
 		irq = hpet_assign_irq(hpet_domain, hc, hc->num);
 		if (irq <= 0)
-- 
2.47.3


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

end of thread, other threads:[~2026-11-19 23:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-17 11:39 [PATCH] x86/hpet: Replace sprintf() with scnprintf() in hpet_select_clockevents() Habil Eren Türker
2026-11-19 23:04 ` Edgecombe, Rick P
2026-11-19 23:28   ` Habil Eren Türker
2026-11-19 23:50     ` Dave Hansen
2026-11-19 23:59       ` Habil Eren Türker

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

all inboxes | Powered by JetHome®