Skip to content

Commit

Permalink
nfp: don't dereference a null nn->eth_port to print a warning
Browse files Browse the repository at this point in the history
On the case where nn->eth_port is null the warning message
is printing the port by dereferencing this null pointer.
Remove the deference to avoid a crash when printing the
warning message.

Detected by CoverityScan, CID#1426198 ("Dereference after null check")

Fixes: ce22f5a ("nfp: separate high level and low level NSP headers")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Colin Ian King authored and David S. Miller committed Apr 8, 2017
1 parent 7cb164e commit 1f1120a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/net/ethernet/netronome/nfp/nfp_net_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,7 @@ static void nfp_net_refresh_netdevs(struct work_struct *work)

list_for_each_entry_safe(nn, next, &pf->ports, port_list) {
if (!nn->eth_port) {
nfp_warn(pf->cpp, "Warning: port %d not present after reconfig\n",
nn->eth_port->eth_index);
nfp_warn(pf->cpp, "Warning: port not present after reconfig\n");
continue;
}
if (!nn->eth_port->override_changed)
Expand Down

0 comments on commit 1f1120a

Please sign in to comment.