Re: [PATCH 07/12] igb: Proactively round up to kmalloc bucket size

Kees Cook
2022-09-22T16:00:29Z

On Thu, Sep 22, 2022 at 03:56:54PM +0000, Ruhl, Michael J wrote:
> >From: dri-devel <dri-devel-bounces@lists.freedesktop.org> On Behalf Of Kees Cook
> [...]
> >diff --git a/drivers/net/ethernet/intel/igb/igb_main.c
> >b/drivers/net/ethernet/intel/igb/igb_main.c
> >index 2796e81d2726..4d70ee5b0f79 100644
> >--- a/drivers/net/ethernet/intel/igb/igb_main.c
> >+++ b/drivers/net/ethernet/intel/igb/igb_main.c
> >@@ -1196,6 +1196,7 @@ static int igb_alloc_q_vector(struct igb_adapter
> >*adapter,
> >
> > ring_count = txr_count + rxr_count;
> > size = struct_size(q_vector, ring, ring_count);
> >+ size = kmalloc_size_roundup(size);
>
> why not:
>
> size = kmalloc_size_roundup(struct_size(q_vector, ring, ring_count));
>
> ?

Sure! I though it might be more readable split up. I will change it. :)

--
Kees Cook