public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Florian Fainelli <florian@openwrt•org>
To: "Rafał Miłecki" <zajec5@gmail•com>
Cc: netdev@vger•kernel.org, "David S. Miller" <davem@davemloft•net>
Subject: Re: [PATCH V2] bgmac: validate MAC addr
Date: Thu, 07 Feb 2013 11:19:54 +0100	[thread overview]
Message-ID: <51137FCA.5090203@openwrt.org> (raw)
In-Reply-To: <1360232078-21872-1-git-send-email-zajec5@gmail.com>

On 02/07/2013 11:14 AM, Rafał Miłecki wrote:
> Signed-off-by: Rafał Miłecki <zajec5@gmail•com>

This is looking good, however some commit message is desirable, 
especially as you are no longer just validating the ethernet MAC 
address, but also generating a new one. Something along those lines 
would probably be enough:

"This patch changes bgmac_probe() to check for a valid Ethernet MAC 
address and in case it is not, will generate a valid random one, such 
that the adapter is still usable."

Thanks!

> ---
> V2: generate random addr
> ---
>   drivers/net/ethernet/broadcom/bgmac.c |    6 ++++++
>   1 file changed, 6 insertions(+)
>
> diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c
> index d08a4af..f90d1dc 100644
> --- a/drivers/net/ethernet/broadcom/bgmac.c
> +++ b/drivers/net/ethernet/broadcom/bgmac.c
> @@ -1318,6 +1318,12 @@ static int bgmac_probe(struct bcma_device *core)
>   		return -ENOTSUPP;
>   	}
>   
> +	if (!is_valid_ether_addr(mac)) {
> +		dev_err(&core->dev, "Invalid MAC addr: %pM\n", mac);
> +		eth_random_addr(mac);
> +		dev_warn(&core->dev, "Using random MAC: %pM\n", mac);
> +	}
> +
>   	/* Allocation and references */
>   	net_dev = alloc_etherdev(sizeof(*bgmac));
>   	if (!net_dev)

  reply	other threads:[~2013-02-07 10:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-06  9:37 [PATCH] bgmac: validate MAC addr Rafał Miłecki
2013-02-06 17:11 ` Florian Fainelli
2013-02-07 10:14 ` [PATCH V2] " Rafał Miłecki
2013-02-07 10:19   ` Florian Fainelli [this message]
2013-02-07 10:27   ` [PATCH V3] bgmac: validate (and random if needed) " Rafał Miłecki
2013-02-08 22:42     ` 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=51137FCA.5090203@openwrt.org \
    --to=florian@openwrt$(echo .)org \
    --cc=davem@davemloft$(echo .)net \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=zajec5@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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