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] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0912131343110.24267@ask.diku.dk>
Date:	Sun, 13 Dec 2009 13:43:26 +0100 (CET)
From:	Julia Lawall <julia@...u.dk>
To:	Florian Fainelli <florian@...nwrt.org>
Cc:	Ben Hutchings <bhutchings@...arflare.com>,
	David Miller <davem@...emloft.net>, netdev@...r.kernel.org
Subject: Re: question about drivers/net/cpmac.c

On Sun, 13 Dec 2009, Florian Fainelli wrote:

> Le dimanche 13 décembre 2009 12:51:59, Ben Hutchings a écrit :
> > On Sun, 2009-12-13 at 12:00 +0100, Julia Lawall wrote:
> > > On Sun, 13 Dec 2009, David Miller wrote:
> > > > From: Julia Lawall <julia@...u.dk>
> > > > Date: Sun, 13 Dec 2009 11:22:54 +0100 (CET)
> > > >
> > > > > The function __devinit cpmac_probe in the file drivers/net/cpmac.c
> > > > > contains the following code:
> > > > >
> > > > > memcpy(dev->dev_addr, pdata->dev_addr, sizeof(dev->dev_addr));
> > > > >
> > > > > Is it correct that the size of the pointer is what is wanted?
> > > >
> > > > Everything that does sizeof(netdev->dev_addr) is a bug.
> > > >
> > > > At some point we changed netdev->dev_addr from an array of chars to a
> > > > pointer to a dynamically allocated buffer.
> > > >
> > > > So these cases worked before that change and need to be updated
> > > > in order to be correct.
> > > >
> > > > Looking quickly there are a couple of these things under
> > > > drivers/net
> > >
> > > Fixed how?  I looked a bit to find where the field was initialized, but
> > > it is just initialized to a field of something else, so it was not so
> > > clear what the size should be.
> > 
> > [...]
> > 
> > The size should be dev->addr_len (assuming that has already been
> > initialised) which will be ETH_ALEN for Ethernet devices.
> 
> From arch/mips/include/asm/mach-ar7/ar7.h:
> 
> struct plat_cpmac_data {
> [..]
>         char dev_addr[6];
> };
> 
> So this should be fine to either use ETH_ALEN or sizeof(pdata->dev_addr).

Thanks.  I will send a patch later today.

julia

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ