Merge branch 'net-mvpp2-Remove-unnecessary-dynamic-allocs'
authorDavid S. Miller <davem@davemloft.net>
Tue, 27 Mar 2018 14:47:23 +0000 (10:47 -0400)
committerDavid S. Miller <davem@davemloft.net>
Tue, 27 Mar 2018 14:47:23 +0000 (10:47 -0400)
commit776d7c5f69ebae12bde4383bea177c3e16732077
tree396d887c6726d2fe71bcf38c20e9b9e7b2996e87
parent8daf1a2d7e40685054ebae680733d822ced6df62
parent0c6d9b44145d8134ebe4e9ebfa02e0dd23744723
Merge branch 'net-mvpp2-Remove-unnecessary-dynamic-allocs'

Maxime Chevallier says:

====================
net: mvpp2: Remove unnecessary dynamic allocs

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.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>