[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <78be1476-ea67-446c-575d-29d69ffa43a7@nvidia.com>
Date: Wed, 27 Oct 2021 11:39:44 +0300
From: Nikolay Aleksandrov <nikolay@...dia.com>
To: Vladimir Oltean <vladimir.oltean@....com>, netdev@...r.kernel.org,
Ido Schimmel <idosch@...dia.com>
Cc: Jakub Kicinski <kuba@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Roopa Prabhu <roopa@...dia.com>, Andrew Lunn <andrew@...n.ch>,
Florian Fainelli <f.fainelli@...il.com>,
Vivien Didelot <vivien.didelot@...il.com>,
Vladimir Oltean <olteanv@...il.com>,
Jiri Pirko <jiri@...dia.com>
Subject: Re: [PATCH net-next 7/8] net: bridge: create a common function for
populating switchdev FDB entries
On 26/10/2021 17:27, Vladimir Oltean wrote:
> There are two places where a switchdev FDB entry is constructed, one is
> br_switchdev_fdb_notify() and the other is br_fdb_replay(). One uses a
> struct initializer, and the other declares the structure as
> uninitialized and populates the elements one by one.
>
> One problem when introducing new members of struct
> switchdev_notifier_fdb_info is that there is a risk for one of these
> functions to run with an uninitialized value.
>
> So centralize the logic of populating such structure into a dedicated
> function. Being the primary location where these structures are created,
> using an uninitialized variable and populating the members one by one
> should be fine, since this one function is supposed to assign values to
> all its members.
>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@....com>
> ---
> net/bridge/br_switchdev.c | 41 +++++++++++++++++++++------------------
> 1 file changed, 22 insertions(+), 19 deletions(-)
>
Acked-by: Nikolay Aleksandrov <nikolay@...dia.com>
Powered by blists - more mailing lists