[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170124130814.GG3781@localhost.localdomain>
Date: Tue, 24 Jan 2017 11:08:14 -0200
From: "'Marcelo Ricardo Leitner'" <marcelo.leitner@...il.com>
To: David Laight <David.Laight@...LAB.COM>
Cc: Neil Horman <nhorman@...driver.com>,
"'Xin Long'" <lucien.xin@...il.com>,
network dev <netdev@...r.kernel.org>,
"linux-sctp@...r.kernel.org" <linux-sctp@...r.kernel.org>,
Vlad Yasevich <vyasevich@...il.com>,
"davem@...emloft.net" <davem@...emloft.net>
Subject: Re: [PATCHv3 net-next 4/4] sctp: implement sender-side procedures
for Add Incoming/Outgoing Streams Request Parameter
On Tue, Jan 24, 2017 at 12:35:39PM +0000, David Laight wrote:
> From: Marcelo Ricardo Leitner
> > Sent: 23 January 2017 16:03
> ...
> > > > Does kcalloc() zero the entire area, or just the length you ask for?
> > > > If the latter you need to zero the rest here.
> > > Better still, just use krealloc. You still need to zero out any space beyond
> > > the old length, but it will make the code shorter, and avoid the need for
> > > additional temporary variables.
> >
> > Seems if we pass gfp | __GFP_ZERO to krealloc it will end up zeroing the
> > slab for us before doing the memcpy.
> > I didn't follow all paths but in slab_alloc_node it will end up calling:
> > if (unlikely(gfpflags & __GFP_ZERO) && object)
> > memset(object, 0, s->object_size);
> > So I would expect that other paths also do it.
>
> You probably don't want krealloc() zeroing all of the new area.
Yep, agreed.
Marcelo
Powered by blists - more mailing lists