Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1617981 > unrolled thread

[PATCH][-next] nfp: don't dereference a null nn->eth_port to print a warning

Started byColin King <colin.king@canonical.com>
First post2017-04-06 15:00 +0200
Last post2017-04-08 17:20 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH][-next] nfp: don't dereference a null nn->eth_port to print a warning Colin King <colin.king@canonical.com> - 2017-04-06 15:00 +0200
    Re: [PATCH][-next] nfp: don't dereference a null nn->eth_port to  print a warning Jakub Kicinski <jakub.kicinski@netronome.com> - 2017-04-07 01:20 +0200
    Re: [PATCH][-next] nfp: don't dereference a null nn->eth_port to  print a warning David Miller <davem@davemloft.net> - 2017-04-08 17:20 +0200

#1617981 — [PATCH][-next] nfp: don't dereference a null nn->eth_port to print a warning

FromColin King <colin.king@canonical.com>
Date2017-04-06 15:00 +0200
Subject[PATCH][-next] nfp: don't dereference a null nn->eth_port to print a warning
Message-ID<ttfb5-cf-35@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1618394 — Re: [PATCH][-next] nfp: don't dereference a null nn->eth_port to print a warning

FromJakub Kicinski <jakub.kicinski@netronome.com>
Date2017-04-07 01:20 +0200
SubjectRe: [PATCH][-next] nfp: don't dereference a null nn->eth_port to print a warning
Message-ID<ttoR4-7uH-9@gated-at.bofh.it>
In reply to#1617981
On Thu,  6 Apr 2017 13:54:35 +0100, Colin King wrote:
> 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>

Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>

Thanks!

[toc] | [prev] | [next] | [standalone]


#1619301 — Re: [PATCH][-next] nfp: don't dereference a null nn->eth_port to print a warning

FromDavid Miller <davem@davemloft.net>
Date2017-04-08 17:20 +0200
SubjectRe: [PATCH][-next] nfp: don't dereference a null nn->eth_port to print a warning
Message-ID<tu0jD-6UX-9@gated-at.bofh.it>
In reply to#1617981
From: Colin King <colin.king@canonical.com>
Date: Thu,  6 Apr 2017 13:54:35 +0100

> 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>

Applied, thanks.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web