linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Antoine Tenart <antoine.tenart@free-electrons.com>
To: davem@davemloft.net, thomas.petazzoni@free-electrons.com
Cc: Antoine Tenart <antoine.tenart@free-electrons.com>,
	andrew@lunn.ch, gregory.clement@free-electrons.com,
	nadavh@marvell.com, linux@armlinux.org.uk,
	linux-kernel@vger.kernel.org, mw@semihalf.com,
	stefanc@marvell.com, netdev@vger.kernel.org
Subject: [PATCH net v2 1/4] net: mvpp2: fix the mac address used when using PPv2.2
Date: Fri, 25 Aug 2017 16:14:17 +0200	[thread overview]
Message-ID: <20170825141420.14027-2-antoine.tenart@free-electrons.com> (raw)
In-Reply-To: <20170825141420.14027-1-antoine.tenart@free-electrons.com>

The mac address is only retrieved from h/w when using PPv2.1. Otherwise
the variable holding it is still checked and used if it contains a valid
value. As the variable isn't initialized to an invalid mac address
value, we end up with random mac addresses which can be the same for all
the ports handled by this PPv2 driver.

Fixes this by initializing the h/w mac address variable to {0}, which is
an invalid mac address value. This way the random assignation fallback
is called and all ports end up with their own addresses.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Fixes: 2697582144dd ("net: mvpp2: handle misc PPv2.1/PPv2.2 differences")
---
 drivers/net/ethernet/marvell/mvpp2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c
index 48d21c1e09f2..4d598ca8503a 100644
--- a/drivers/net/ethernet/marvell/mvpp2.c
+++ b/drivers/net/ethernet/marvell/mvpp2.c
@@ -6504,7 +6504,7 @@ static int mvpp2_port_probe(struct platform_device *pdev,
 	struct resource *res;
 	const char *dt_mac_addr;
 	const char *mac_from;
-	char hw_mac_addr[ETH_ALEN];
+	char hw_mac_addr[ETH_ALEN] = {0};
 	u32 id;
 	int features;
 	int phy_mode;
-- 
2.13.5

  reply	other threads:[~2017-08-25 14:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-25 14:14 [PATCH net v2 0/4] net: mvpp2: fix the mac address retrieval logic Antoine Tenart
2017-08-25 14:14 ` Antoine Tenart [this message]
2017-08-25 14:19   ` [PATCH net v2 1/4] net: mvpp2: fix the mac address used when using PPv2.2 Andrew Lunn
2017-08-25 14:29     ` Antoine Tenart
2017-08-25 15:42       ` Andrew Lunn
2017-08-25 15:54         ` Antoine Tenart
2017-08-28 18:25   ` David Miller
2017-08-25 14:14 ` [PATCH net v2 2/4] net: mvpp2: move the mac retrieval/copy logic into its own function Antoine Tenart
2017-08-25 14:14 ` [PATCH net v2 3/4] net: mvpp2: fix use of the random mac address for PPv2.2 Antoine Tenart
2017-08-25 14:14 ` [PATCH net v2 4/4] net: mvpp2: fallback using h/w and random mac if the dt one isn't valid Antoine Tenart

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=20170825141420.14027-2-antoine.tenart@free-electrons.com \
    --to=antoine.tenart@free-electrons.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=gregory.clement@free-electrons.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mw@semihalf.com \
    --cc=nadavh@marvell.com \
    --cc=netdev@vger.kernel.org \
    --cc=stefanc@marvell.com \
    --cc=thomas.petazzoni@free-electrons.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;
as well as URLs for NNTP newsgroup(s).