[PATCH v2 05/15] serial: core: replace snprintf with more robust scnprintf
From: Hugo Villeneuve
Date: Tue Apr 28 2026 - 13:59:48 EST
From: Hugo Villeneuve <hvilleneuve@xxxxxxxxxxxx>
Use scnprintf() so we could perhaps one day get rid of snprintf() entirely.
Suggested-by: Ilpo Järvinen <ilpo.jarvinen@xxxxxxxxxxxxxxx>
Signed-off-by: Hugo Villeneuve <hvilleneuve@xxxxxxxxxxxx>
---
drivers/tty/serial/serial_core.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index c5ef2dd00a9c9ad57c4010c05daea34fd2053676..3c909b8a82135a6245e98a9ae6bb050fc32590cc 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -2487,11 +2487,11 @@ uart_report_port(struct uart_driver *drv, struct uart_port *port)
switch (port->iotype) {
case UPIO_PORT:
- snprintf(address, sizeof(address), "I/O 0x%lx", port->iobase);
+ scnprintf(address, sizeof(address), "I/O 0x%lx", port->iobase);
break;
case UPIO_HUB6:
- snprintf(address, sizeof(address),
- "I/O 0x%lx offset 0x%x", port->iobase, port->hub6);
+ scnprintf(address, sizeof(address),
+ "I/O 0x%lx offset 0x%x", port->iobase, port->hub6);
break;
case UPIO_MEM:
case UPIO_MEM16:
@@ -2499,8 +2499,8 @@ uart_report_port(struct uart_driver *drv, struct uart_port *port)
case UPIO_MEM32BE:
case UPIO_AU:
case UPIO_TSI:
- snprintf(address, sizeof(address),
- "MMIO 0x%llx", (unsigned long long)port->mapbase);
+ scnprintf(address, sizeof(address),
+ "MMIO 0x%llx", (unsigned long long)port->mapbase);
break;
default:
strscpy(address, "*unknown*", sizeof(address));
--
2.47.3