lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdXAwgtwbCV_=qJnrs=YPZksoEBkjnQB=JbR7fc+UyKdzw@mail.gmail.com>
Date:	Sat, 25 Feb 2012 11:15:21 +0100
From:	Geert Uytterhoeven <geert@...ux-m68k.org>
To:	Danny Kukawka <danny.kukawka@...ect.de>
Cc:	"David S. Miller" <davem@...emloft.net>,
	Danny Kukawka <dkukawka@...e.de>,
	Jeff Kirsher <jeffrey.t.kirsher@...el.com>,
	Jiri Pirko <jpirko@...hat.com>, netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 03/11] cirrus/mac89x0: print MAC via printk format specifier

On Fri, Feb 24, 2012 at 14:45, Danny Kukawka <danny.kukawka@...ect.de> wrote:
> Print MAC/dev_addr via printk extended format specifier %pM instead
> of custom code.
>
> Use memcpy to set the address to dev->dev_addr in set_mac_address,
> instead of mxing it up in a for loop with printing a debug msg.
>
> Check also if the given address is valid.

Why do you sneak in this check in this patch?

> Signed-off-by: Danny Kukawka <danny.kukawka@...ect.de>
> ---
>  drivers/net/ethernet/cirrus/mac89x0.c |   12 ++++++++----
>  1 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/cirrus/mac89x0.c b/drivers/net/ethernet/cirrus/mac89x0.c
> index 83781f3..a7324ce 100644
> --- a/drivers/net/ethernet/cirrus/mac89x0.c
> +++ b/drivers/net/ethernet/cirrus/mac89x0.c
> @@ -592,10 +592,14 @@ static void set_multicast_list(struct net_device *dev)
>  static int set_mac_address(struct net_device *dev, void *addr)
>  {
>        int i;
> -       printk("%s: Setting MAC address to ", dev->name);
> -       for (i = 0; i < 6; i++)
> -               printk(" %2.2x", dev->dev_addr[i] = ((unsigned char *)addr)[i]);
> -       printk(".\n");
> +       struct sockaddr *saddr = addr;
> +
> +       if (!is_valid_ether_addr(addr->sa_data))
> +               return -EADDRNOTAVAIL;
> +
> +       memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
> +       printk("%s: Setting MAC address to %pM\n", dev->name, dev->dev_addr);
> +
>        /* set the Ethernet address */
>        for (i=0; i < ETH_ALEN/2; i++)
>                writereg(dev, PP_IA+i*2, dev->dev_addr[i*2] | (dev->dev_addr[i*2+1] << 8));

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ