nfp: flower: add check for flower VF netdevs for get/set_eeprom
authorJames Hershaw <james.hershaw@corigine.com>
Mon, 6 Feb 2023 15:48:36 +0000 (16:48 +0100)
committerJakub Kicinski <kuba@kernel.org>
Wed, 8 Feb 2023 04:20:37 +0000 (20:20 -0800)
commitf817554786ddc75e0960ea542061fc43a1f2f7e2
tree1067b604576f85faa6200270bbcd9fff0efb38ef
parentb24e9de39880e700f9a6ea9b5d33bb0d81e9cf81
nfp: flower: add check for flower VF netdevs for get/set_eeprom

Move the nfp_net_get_port_mac_by_hwinfo() check to ahead in the
get/set_eeprom() functions to in order to check for a VF netdev, which
this function does not support.

It is debatable if this is a fix or an enhancement, and we have chosen
to go for the latter. It does address a problem introduced by
commit 74b4f1739d4e ("nfp: flower: change get/set_eeprom logic and enable for flower reps").
However, the ethtool->len == 0 check avoids the problem manifesting as a
run-time bug (NULL pointer dereference of app).

Signed-off-by: James Hershaw <james.hershaw@corigine.com>
Reviewed-by: Louis Peens <louis.peens@corigine.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Link: https://lore.kernel.org/r/20230206154836.2803995-1-simon.horman@corigine.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c