[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20101230080405.GL14221@pengutronix.de>
Date: Thu, 30 Dec 2010 09:04:05 +0100
From: Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>
To: Shawn Guo <shawn.guo@...escale.com>
Cc: Baruch Siach <baruch@...s.co.il>, davem@...emloft.net,
gerg@...pgear.com, eric@...rea.com, bryan.wu@...onical.com,
r64343@...escale.com, B32542@...escale.com, lw@...o-electronics.de,
w.sang@...gutronix.de, s.hauer@...gutronix.de,
linux-arm-kernel@...ts.infradead.org, netdev@...r.kernel.org
Subject: Re: [PATCH 03/10] net/fec: add mac field into platform data and
consolidate fec_get_mac
Hello Shawn,
On Thu, Dec 30, 2010 at 10:12:44AM +0800, Shawn Guo wrote:
> On Wed, Dec 29, 2010 at 01:42:21PM +0100, Uwe Kleine-König wrote:
> > On Wed, Dec 29, 2010 at 07:58:09PM +0800, Shawn Guo wrote:
> > > On Wed, Dec 29, 2010 at 11:31:38AM +0100, Uwe Kleine-König wrote:
> > > > On Wed, Dec 29, 2010 at 06:05:21PM +0800, Shawn Guo wrote:
> > > > > On Wed, Dec 29, 2010 at 08:53:30AM +0200, Baruch Siach wrote:
> > > > > if (iap == fec_mac_default)
> > > > > dev->dev_addr[ETH_ALEN-1] = fec_mac_default[ETH_ALEN-1] + fep->pdev->id;
> > > > Can this overflow? (I didn't check the code, so my concern might be
> > > > completely stupid here.)
> > > No. dev->dev_addr points to netdev_hw_addr->addr, which is a 32 bytes array.
> > I didn't mean an out-of-bound access, but what is if
> > fec_mac_default[ETH_ALEN-1] is 0xff and you add 1? Does that result in
> > 0x100 or 0? What if id is <0? For big ids you might even handle a
> > carry to indixes <ETH_ALEN-2.
> >
> First of all, all my patch did is changing fep->index to,
> fep->pdev->id, which should not bring any problem you are concerned.
>
> Secondly, I do not understand how the overflow on
> fec_mac_default[ETH_ALEN-1] can result in a carry on the next array
> element. Here is what I'm seeing with fec_mac=00:04:9f:01:30:ff.
There is no automatic carry to the next array element. I just wondered
how overflow should be handled ...
> eth0 Link encap:Ethernet HWaddr 00:04:9F:01:30:FF
> eth1 Link encap:Ethernet HWaddr 00:04:9F:01:30:00
If this is intended, it's totally OK for me.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
--
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