Skip to contentSkip to conversation

serial: samsung: Change MAX_CLK_NAME_LENGTH to 17

PATCH In review Kwanghoon Son 3 participants 5 messages Jun 5, 2024 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): CGME20240605040759epcas1p36d200e262d9a98f9879cf7fd0ee94bba@epcas1p3.samsung.com

#1 lore raw

PATCH 1/1 serial: samsung: Change MAX_CLK_NAME_LENGTH to 17

clkname "clk_uart_baud" already 13 byte, so compiler warns drivers/tty/serial/samsung_tty.c:1392:17: note: ‘sprintf’ output between 15 and 17 bytes into a destination of size 15

---
 drivers/tty/serial/samsung_tty.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/samsung_tty.c +1 -1
index dc35eb77d2ef..cad838ac8aa2 100644
@@ -1339,7 +1339,7 @@ static void s3c24xx_serial_pm(struct uart_port *port, unsigned int level,
  *
  */
 
-#define MAX_CLK_NAME_LENGTH 15
+#define MAX_CLK_NAME_LENGTH 17
 
 static inline u8 s3c24xx_serial_getsource(struct uart_port *port)
 {
Signature · 1 line
2.39.2
#2 lore raw
Quoted 2 lines · Kwanghoon Son

clkname "clk_uart_baud" already 13 byte, so compiler warns drivers/tty/serial/samsung_tty.c:1392:17: note: ‘sprintf’ output between 15 and 17 bytes into a destination of size 15

But that's not true. We do not write there more than 15, including terminating NULL byte, right?

Or you just sent whatever is there to silence warning?

Best regards,
Krzysztof

#3 lore raw
Quoted 2 lines · Krzysztof Kozlowski

But that's not true. We do not write there more than 15, including terminating NULL byte, right?

For now, right. only clk_uart_baud[0-3] acceptable.

I thought this meaningful in code side, clk_num u8 can over in future. Also don't want to see warnings.

But if It's false warning(device tree constrain), please ignore patch.

Thanks for review.

Kwang.

Quoted 5 lines

Or you just sent whatever is there to silence warning?

Best regards,
Krzysztof

#4 lore raw
Quoted 7 lines · Kwanghoon Son
Quoted 2 lines · Krzysztof Kozlowski

But that's not true. We do not write there more than 15, including terminating NULL byte, right?

For now, right. only clk_uart_baud[0-3] acceptable.

I thought this meaningful in code side, clk_num u8 can over in future.

But it can't now.

Quoted 3 lines

Also don't want to see warnings.

But if It's false warning(device tree constrain), please ignore patch.

To me the warning is a false positive.

Best regards,
Krzysztof

reviewer
#5 lore raw
In reply to Kwanghoon Son
Quoted 11 lines

-----Original Message-----
From: Kwanghoon Son <[email protected]>
Sent: Wednesday, June 5, 2024 9:37 AM
To: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]
Cc: Kwanghoon Son <[email protected]>
Subject: [PATCH] serial: samsung: Change MAX_CLK_NAME_LENGTH to 17

Quoted 3 lines

clkname "clk_uart_baud" already 13 byte, so compiler warns drivers/tty/serial/samsung_tty.c:1392:17: note: ‘sprintf’ output between 15 and 17 bytes into a destination of size 15

There was a similar discussion around buffer size of clkname last year
https://www.spinics.net/lists/arm-kernel/msg1039769.html
and it was concluded that it’s a false warning AFAIR.

Quoted 21 lines
---
 drivers/tty/serial/samsung_tty.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/samsung_tty.c +1 -2
index dc35eb77d2ef..cad838ac8aa2 100644
@@ -1339,7 +1339,7 @@ static void s3c24xx_serial_pm(struct uart_port *port,
 unsigned int level,
  *
  */
 
-#define MAX_CLK_NAME_LENGTH 15
+#define MAX_CLK_NAME_LENGTH 17
 
 static inline u8 s3c24xx_serial_getsource(struct uart_port *port)  {
--

2.39.2