From: Colin King <colin.king@canonical.com>
To: Jakub Kicinski <jakub.kicinski@netronome.com>,
"David S . Miller" <davem@davemloft.net>,
Simon Horman <simon.horman@netronome.com>,
oss-drivers@netronome.com, netdev@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH][-next] nfp: don't dereference a null nn->eth_port to print a warning
Date: Thu, 06 Apr 2017 12:54:35 +0000 [thread overview]
Message-ID: <20170406125435.18898-1-colin.king@canonical.com> (raw)
From: Colin Ian King <colin.king@canonical.com>
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: ce22f5a2cbe3c627 ("nfp: separate high level and low level NSP headers")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/net/ethernet/netronome/nfp/nfp_net_main.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_main.c b/drivers/net/ethernet/netronome/nfp/nfp_net_main.c
index 3e1f97e88710..4c6863a072d3 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_main.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_main.c
@@ -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)
--
2.11.0
next reply other threads:[~2017-04-06 12:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-06 12:54 Colin King [this message]
2017-04-06 23:15 ` [PATCH][-next] nfp: don't dereference a null nn->eth_port to print a warning Jakub Kicinski
2017-04-08 15:14 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170406125435.18898-1-colin.king@canonical.com \
--to=colin.king@canonical.com \
--cc=davem@davemloft.net \
--cc=jakub.kicinski@netronome.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=oss-drivers@netronome.com \
--cc=simon.horman@netronome.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox