From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pavel Machek Subject: Re: [PATCH v2] net: dsa: Remove VLA usage Date: Sun, 29 Jul 2018 13:38:06 +0200 Message-ID: <20180729113806.GC7333@amd> References: <20180717041034.GA37382@beast> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="f0KYrhQ4vYSV2aJu" Cc: "David S. Miller" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Salvatore Mesoraca , Florian Fainelli , Andrew Lunn , David Laight To: Kees Cook Return-path: Content-Disposition: inline In-Reply-To: <20180717041034.GA37382@beast> Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org --f0KYrhQ4vYSV2aJu Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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). >=20 > Link: http://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=3DqPXy= dAacU1RqZWA@mail.gmail.com > Link: http://lkml.kernel.org/r/20180505185145.GB32630@lunn.ch > Signed-off-by: Salvatore Mesoraca > [kees: tweak commit subject and message slightly] > Signed-off-by: Kees Cook > --- > include/net/dsa.h | 3 +++ > net/dsa/dsa2.c | 14 ++++++++++++++ > net/dsa/switch.c | 22 ++++++++++------------ > 3 files changed, 27 insertions(+), 12 deletions(-) >=20 > 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; > =20 > + unsigned long *bitmap; > + unsigned long _bitmap; This looks rather confusing. _bitmap -> bitmap_data? bitmap_bits? Thanks, Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --f0KYrhQ4vYSV2aJu Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAltdpx4ACgkQMOfwapXb+vJQXACghehUUfVekVsOJ8nQWxHR8cJy q/4AoIr/9zPQYmIPJ+lqQQ6PQPwYz7tO =IUZz -----END PGP SIGNATURE----- --f0KYrhQ4vYSV2aJu--