linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] net: mvpp2: Remove unnecessary dynamic allocs
@ 2018-03-26 13:34 Maxime Chevallier
  2018-03-26 13:34 ` [PATCH net-next 1/2] net: mvpp2: Make mvpp2_prs_hw_read a parser entry init function Maxime Chevallier
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Maxime Chevallier @ 2018-03-26 13:34 UTC (permalink / raw)
  To: davem
  Cc: Maxime Chevallier, netdev, linux-kernel, Antoine Tenart,
	thomas.petazzoni, gregory.clement, miquel.raynal, nadavh,
	stefanc, ymarkman, mw

Some utility functions in mvpp2 make use of dynamic alloc to exchange temporary
objects representing Parser Entries (which are generic filtering entries in the
PPv2 controller).

These objects are small (44 bytes each), we can use the stack to exchange them.

Some previous discussion on this topic showed that the mvpp2_prs_hw_read, which
initializes a struct mvpp2_prs_entry based on one of its fields, can easily lead
to erroneous code if we don't zero-out the struct beforehand :

https://lkml.org/lkml/2018/3/21/739

To fix this, I propose to rename mvpp2_prs_hw_read into mvpp2_prs_init_from_hw,
make it zero-out the struct and take the index as a parameter. That's what's
done in the first patch of the series.

The second patch is the V3 of
("net: mvpp2: Don't use dynamic allocs for local variables"), making use of
mvpp2_prs_init_from_hw and taking previous comments into account.

Maxime Chevallier (2):
  net: mvpp2: Make mvpp2_prs_hw_read a parser entry init function
  net: mvpp2: Don't use dynamic allocs for local variables

 drivers/net/ethernet/marvell/mvpp2.c | 320 +++++++++++++++--------------------
 1 file changed, 137 insertions(+), 183 deletions(-)

-- 
2.11.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-03-27 14:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-26 13:34 [PATCH net-next 0/2] net: mvpp2: Remove unnecessary dynamic allocs Maxime Chevallier
2018-03-26 13:34 ` [PATCH net-next 1/2] net: mvpp2: Make mvpp2_prs_hw_read a parser entry init function Maxime Chevallier
2018-03-26 13:34 ` [PATCH net-next 2/2] net: mvpp2: Don't use dynamic allocs for local variables Maxime Chevallier
2018-03-27 14:47 ` [PATCH net-next 0/2] net: mvpp2: Remove unnecessary dynamic allocs David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).