Linux Serial subsystem development
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: jiang.peng9@zte.com.cn
Cc: shao.mingyin@zte.com.cn, alim.akhtar@samsung.com,
	yang.yang29@zte.com.cn, xu.xin16@zte.com.cn,
	ye.xingchen@zte.com.cn, gregkh@linuxfoundation.org,
	jirislaby@kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-serial@vger.kernel.org
Subject: Re: [PATCH] tty: serial: samsung: Fix potential buffer overflow in clkname
Date: Wed, 2 Apr 2025 08:27:26 +0200	[thread overview]
Message-ID: <fe6ec03b-c1c5-417f-9aec-1b81731b3018@kernel.org> (raw)
In-Reply-To: <202504020933293306VVVuy_8HVKbwBOL2PFjW@zte.com.cn>

On 02/04/2025 03:33, jiang.peng9@zte.com.cn wrote:
>> 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:

No need, it was already on the lists many times.

> 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.
> The fix:
> Increased clkname buffer size from 15 to 18 chars
> (original 14 chars + 3 digits + null = 18)
> Replaced sprintf() with snprintf() for safety
> This keeps the pattern consistent while eliminating the warning. Tested with CONFIG_SERIAL_SAMSUNG=y builds.

That's not a test. Test is running on a device. Compiling is not a test.

> Would you prefer any adjustments to this approach?
Same comments as for previous cases. Go search other discussions.

Best regards,
Krzysztof

  parent reply	other threads:[~2025-04-02  6:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-01 11:24 [PATCH] tty: serial: samsung: Fix potential buffer overflow in clkname shao.mingyin
2025-04-01 12:52 ` Krzysztof Kozlowski
2025-04-02  1:33   ` jiang.peng9
2025-04-02  4:44     ` Jiri Slaby
2025-04-02  6:28       ` jiang.peng9
2025-04-02  6:27     ` Krzysztof Kozlowski [this message]
2025-04-02  6:49       ` jiang.peng9

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fe6ec03b-c1c5-417f-9aec-1b81731b3018@kernel.org \
    --to=krzk@kernel.org \
    --cc=alim.akhtar@samsung.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jiang.peng9@zte.com.cn \
    --cc=jirislaby@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=shao.mingyin@zte.com.cn \
    --cc=xu.xin16@zte.com.cn \
    --cc=yang.yang29@zte.com.cn \
    --cc=ye.xingchen@zte.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox