diff mbox series

serial: samsung: Change MAX_CLK_NAME_LENGTH to 17

Message ID 20240605040719.160778-1-k.son@samsung.com (mailing list archive)
State New
Headers show
Series serial: samsung: Change MAX_CLK_NAME_LENGTH to 17 | expand

Commit Message

Kwanghoon Son June 5, 2024, 4:07 a.m. UTC
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

Signed-off-by: Kwanghoon Son <k.son@samsung.com>
---
 drivers/tty/serial/samsung_tty.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Krzysztof Kozlowski June 5, 2024, 6:42 a.m. UTC | #1
On 05/06/2024 06:07, Kwanghoon Son wrote:
> 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
Kwanghoon Son June 5, 2024, 7:52 a.m. UTC | #2
On 6/5/24 3:42 PM, Krzysztof Kozlowski wrote:
> 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.

> Or you just sent whatever is there to silence warning?
>
> Best regards,
> Krzysztof
>
Krzysztof Kozlowski June 5, 2024, 7:54 a.m. UTC | #3
On 05/06/2024 09:52, Kwanghoon Son wrote:
> On 6/5/24 3:42 PM, Krzysztof Kozlowski wrote:
>> 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.

> 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
Alim Akhtar June 5, 2024, 9:03 a.m. UTC | #4
> -----Original Message-----
> From: Kwanghoon Son <k.son@samsung.com>
> Sent: Wednesday, June 5, 2024 9:37 AM
> To: krzk@kernel.org; alim.akhtar@samsung.com; gregkh@linuxfoundation.org;
> jirislaby@kernel.org; linux-samsung-soc@vger.kernel.org; linux-
> serial@vger.kernel.org
> Cc: Kwanghoon Son <k.son@samsung.com>
> Subject: [PATCH] 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

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. 
 

> 
> Signed-off-by: Kwanghoon Son <k.son@samsung.com>
> ---
>  drivers/tty/serial/samsung_tty.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c
> index dc35eb77d2ef..cad838ac8aa2 100644
> --- a/drivers/tty/serial/samsung_tty.c
> +++ b/drivers/tty/serial/samsung_tty.c
> @@ -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
diff mbox series

Patch

diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c
index dc35eb77d2ef..cad838ac8aa2 100644
--- a/drivers/tty/serial/samsung_tty.c
+++ b/drivers/tty/serial/samsung_tty.c
@@ -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)
 {