[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6DB026CAD7@AcuExch.aculab.com>
Date: Tue, 24 Jan 2017 12:35:39 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Marcelo Ricardo Leitner' <marcelo.leitner@...il.com>,
Neil Horman <nhorman@...driver.com>
CC: '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
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.
David
Powered by blists - more mailing lists