public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Brian Masney <bmasney@redhat.com>
Cc: irusskikh@marvell.com, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, cth451@gmail.com
Subject: Re: [PATCH] net: atlantic: fix check for invalid ethernet addresses
Date: Wed, 30 Nov 2022 20:41:29 +0100	[thread overview]
Message-ID: <Y4ex6WqiY8IdwfHe@lunn.ch> (raw)
In-Reply-To: <20221130174259.1591567-1-bmasney@redhat.com>

On Wed, Nov 30, 2022 at 12:42:59PM -0500, Brian Masney wrote:
> The Qualcomm sa8540p automotive development board (QDrive3) has an
> Aquantia NIC wired over PCIe. The ethernet MAC address assigned to
> all of the boards in our lab is 00:17:b6:00:00:00. The existing
> check in aq_nic_is_valid_ether_addr() only checks for leading zeros
> in the MAC address. Let's update the check to also check for trailing
> zeros in the MAC address so that a random MAC address is assigned
> in this case.
> 
> Signed-off-by: Brian Masney <bmasney@redhat.com>
> ---
>  drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
> index 06508eebb585..c9c850bbc805 100644
> --- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
> +++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
> @@ -293,7 +293,8 @@ static bool aq_nic_is_valid_ether_addr(const u8 *addr)
>  	/* Some engineering samples of Aquantia NICs are provisioned with a
>  	 * partially populated MAC, which is still invalid.
>  	 */
> -	return !(addr[0] == 0 && addr[1] == 0 && addr[2] == 0);
> +	return !(addr[0] == 0 && addr[1] == 0 && addr[2] == 0) &&
> +		!(addr[3] == 0 && addr[4] == 0 && addr[5] == 0);

Hi Brian

is_valid_ether_addr()

	Andrew

  parent reply	other threads:[~2022-11-30 19:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-30 17:42 [PATCH] net: atlantic: fix check for invalid ethernet addresses Brian Masney
2022-11-30 17:57 ` Brian Masney
2022-11-30 18:26   ` Tianhao Chai
2022-11-30 18:47     ` Brian Masney
2022-11-30 19:41 ` Andrew Lunn [this message]
2022-11-30 21:08   ` Brian Masney
2022-11-30 21:32     ` Andrew Lunn
2022-11-30 23:12       ` David Laight
2022-12-01  2:22         ` Andrew Lunn
2022-12-01  8:07       ` [EXT] " Igor Russkikh
2022-12-01 13:55         ` Brian Masney
2022-12-01 14:14         ` Andrew Lunn
2022-12-01 15:18           ` Igor Russkikh

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=Y4ex6WqiY8IdwfHe@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=bmasney@redhat.com \
    --cc=cth451@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=irusskikh@marvell.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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