[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180729114006.GA11104@amd>
Date: Sun, 29 Jul 2018 13:40:06 +0200
From: Pavel Machek <pavel@....cz>
To: Kees Cook <keescook@...omium.org>
Cc: "David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
Salvatore Mesoraca <s.mesoraca16@...il.com>,
Florian Fainelli <f.fainelli@...il.com>,
Andrew Lunn <andrew@...n.ch>,
David Laight <David.Laight@...lab.com>
Subject: Re: [PATCH v2] net: dsa: Remove VLA usage
Hi!
> > We avoid 2 VLAs by using a pre-allocated field in dsa_switch. We also
> > try to avoid dynamic allocation whenever possible (when using fewer than
> > bits-per-long ports, which is the common case).
> >
> > Link: http://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qPXydAacU1RqZWA@mail.gmail.com
> > Link: http://lkml.kernel.org/r/20180505185145.GB32630@lunn.ch
> > Signed-off-by: Salvatore Mesoraca <s.mesoraca16@...il.com>
> > [kees: tweak commit subject and message slightly]
> > Signed-off-by: Kees Cook <keescook@...omium.org>
> > ---
> > include/net/dsa.h | 3 +++
> > net/dsa/dsa2.c | 14 ++++++++++++++
> > net/dsa/switch.c | 22 ++++++++++------------
> > 3 files changed, 27 insertions(+), 12 deletions(-)
> >
> > diff --git a/include/net/dsa.h b/include/net/dsa.h
> > index fdbd6082945d..461e8a7661b7 100644
> > --- a/include/net/dsa.h
> > +++ b/include/net/dsa.h
> > @@ -259,6 +259,9 @@ struct dsa_switch {
> > /* Number of switch port queues */
> > unsigned int num_tx_queues;
> >
> > + unsigned long *bitmap;
> > + unsigned long _bitmap;
>
> This looks rather confusing. _bitmap -> bitmap_data? bitmap_bits?
Actually, AFAICT that long is not used as a long, but as array of
bits. So maybe char bitmap_data[8] would be more appropriate?
(resend, now with right cc list).
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)
Powered by blists - more mailing lists