From: Eric Dumazet <eric.dumazet@gmail.com>
To: Hangbin Liu <liuhangbin@gmail.com>,
Eric Dumazet <eric.dumazet@gmail.com>
Cc: Jiri Benc <jbenc@redhat.com>,
netdev@vger.kernel.org, Eric Dumazet <edumazet@google.com>,
"David S . Miller" <davem@davemloft.net>
Subject: Re: [PATCH net] tcp: switch snprintf to scnprintf
Date: Mon, 18 Nov 2019 19:48:32 -0800 [thread overview]
Message-ID: <22361732-351e-4768-0974-bd4050eb9f2e@gmail.com> (raw)
In-Reply-To: <20191119015338.GD18865@dhcp-12-139.nay.redhat.com>
On 11/18/19 5:53 PM, Hangbin Liu wrote:
> On Fri, Nov 15, 2019 at 10:54:55AM +0100, Jiri Benc wrote:
>> On Fri, 15 Nov 2019 10:41:06 +0800, Hangbin Liu wrote:
>>>> We need to properly size the output buffers before using them,
>>>> we can not afford truncating silently the output.
>>>
>>> Yes, I agree. Just as I said, the buffer is still enough, while scnprintf
>>> is just a safer usage compired with snprintf.
>>
>> So maybe keep snprintf but add WARN_ON and bail out of the loop if the
>> buffer size was reached?
>>
>> if (WARN_ON(offs >= maxlen))
>> break;
>>
>
> Hi Eric,
>
> What do you think?
>
WARN_ON_ONCE() please...
next prev parent reply other threads:[~2019-11-19 3:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-14 10:28 [PATCH net] tcp: switch snprintf to scnprintf Hangbin Liu
2019-11-14 14:28 ` Eric Dumazet
2019-11-15 2:41 ` Hangbin Liu
2019-11-15 9:54 ` Jiri Benc
2019-11-19 1:53 ` Hangbin Liu
2019-11-19 3:48 ` Eric Dumazet [this message]
2019-11-19 13:40 ` Hangbin Liu
2019-11-19 17:17 ` Eric Dumazet
2019-11-20 8:38 ` [PATCHv2 net-next] tcp: warn if offset reach the maxlen limit when using snprintf Hangbin Liu
2019-11-21 6:23 ` David Miller
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=22361732-351e-4768-0974-bd4050eb9f2e@gmail.com \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jbenc@redhat.com \
--cc=liuhangbin@gmail.com \
--cc=netdev@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).