mlxsw: spectrum_switchdev: Check status of memory allocation
authorIdo Schimmel <[email protected]>
Wed, 12 Jul 2017 07:12:55 +0000 (09:12 +0200)
committerDavid S. Miller <[email protected]>
Wed, 12 Jul 2017 15:15:52 +0000 (08:15 -0700)
commit6f497930af73863b32e8c73947a52d1003af31e2
treeac244ff50fadeadd355f6bd436f45b37f2c5c24e
parenta9265b804dfdfca4e2ce3730fe0528da9c01dbf7
mlxsw: spectrum_switchdev: Check status of memory allocation

We can't rely on kzalloc() always succeeding, so check its return value.

Suppresses the following smatch error:

mlxsw_sp_switchdev_event() error: potential null dereference
'switchdev_work->fdb_info.addr'.  (kzalloc returns
 null)

Fixes: af061378924f ("mlxsw: spectrum_switchdev: Add support for learning FDB through notification")
Signed-off-by: Ido Schimmel <[email protected]>
Signed-off-by: Jiri Pirko <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c