[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191119134051.GE18865@dhcp-12-139.nay.redhat.com>
Date: Tue, 19 Nov 2019 21:40:51 +0800
From: Hangbin Liu <liuhangbin@...il.com>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: Jiri Benc <jbenc@...hat.com>, netdev@...r.kernel.org,
Eric Dumazet <edumazet@...gle.com>,
"David S . Miller" <davem@...emloft.net>
Subject: Re: [PATCH net] tcp: switch snprintf to scnprintf
On Mon, Nov 18, 2019 at 07:48:32PM -0800, Eric Dumazet wrote:
>
>
> 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...
>
OK, I will post a v2 update. Should it target to net or net-next?
Thanks
Hangbin
Powered by blists - more mailing lists