[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250402142803400kEFf9oOyQ7Y4Gq456dQg4@zte.com.cn>
Date: Wed, 2 Apr 2025 14:28:03 +0800 (CST)
From: <jiang.peng9@....com.cn>
To: <jirislaby@...nel.org>
Cc: <krzk@...nel.org>, <shao.mingyin@....com.cn>, <alim.akhtar@...sung.com>,
<yang.yang29@....com.cn>, <xu.xin16@....com.cn>,
<ye.xingchen@....com.cn>, <gregkh@...uxfoundation.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-samsung-soc@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-serial@...r.kernel.org>
Subject: Re: [PATCH] tty: serial: samsung: Fix potential buffer overflow in clkname
>>> Same comments as with other patches, not possible, IMO. Plus this patch
>>> looks actually worse - commit msg is hardly readable.
>>>
>>> Best regards,
>>> Krzysztof
>>
>> Hi Krzysztof,
>> Thank you for your feedback. Let me briefly re-explain the change:
>> The issue:
>> When building with W=1, we get a format-overflow warning because "clk_uart_baud%d" could write 15-17 bytes >(14 chars + 1-3 digits) into a 15-byte buffer.
>
> Hi,
>
> how did you come to "1-3 digits"?
Hi jirislaby,
Thanks for the follow-up! Let me clarify:
Since num_clks is an unsigned char, it could technically go up to 255. The compiler’s analysis seems to align with this.
While I’m not sure if real-world usage ever needs 3-digit values (like 100+), addressing the warning proactively seems worthwhile.
The change eliminates the compiler warning while adding minimal overhead. Better safe than sorry!
Happy to refine this further if you’d prefer a different approach.
Best regards
Peng Jiang
Powered by blists - more mailing lists