Messages in this thread | | | Date | Fri, 21 Oct 2022 09:10:21 -0700 | From | Kees Cook <> | Subject | Re: [PATCH v3][next] skbuff: Proactively round up to kmalloc bucket size |
| |
On Thu, Oct 20, 2022 at 10:42:47AM +0200, Paolo Abeni wrote: > > size = SKB_DATA_ALIGN(size); > > size += SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); > > - data = kmalloc_reserve(size, gfp_mask, node, &pfmemalloc); > > - if (unlikely(!data)) > > - goto nodata; > > I'm sorry for not noticing the above in the previous iteration, but I > think this revision will produce worse code than the V1, as > kmalloc_reserve() now pollutes an additional register. > > Why did you prefer adding an additional parameter to kmalloc_reserve()? > I think computing the alloc_size in the caller is even more readable. > > Additionally, as a matter of personal preference, I would not introduce > an additional variable for alloc_size, just: > > // ... > size = kmalloc_size_roundup(size); > data = kmalloc_reserve(size, gfp_mask, node, &pfmemalloc); > > The rationale is smaller diff, and consistent style with the existing > code where 'size' is already adjusted multiple times icrementally.
Sure, I can do that. I will respin it. :)
-- Kees Cook
| |