Jan Kiszka wrote:
> On 2011-04-18 13:30, Sebastian Smolorz wrote:
> > Since kernel 2.6.31 dev_addr in struct net_device is a pointer and
> > not an array itself. Copying of the MAC address from rtethX to vnicX
> > did not work since then.
> >
> > This patch sets the memcpy length to MAX_ADDR_LEN. This define
> > exists in the kernel since the old 2.4 days and didn't change its
> > meaning, so it can be considered as a safe length to use for this
> > memcpy operation.
> >
> > Signed-off-by: Sebastian Smolorz <sm...@rt...>
> > ---
> >
> > stack/rtmac/rtmac_vnic.c | 2 +-
> > 1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/stack/rtmac/rtmac_vnic.c b/stack/rtmac/rtmac_vnic.c
> > index 5358028..9e929c5 100644
> > --- a/stack/rtmac/rtmac_vnic.c
> > +++ b/stack/rtmac/rtmac_vnic.c
> > @@ -131,7 +131,7 @@ static int rtmac_vnic_copy_mac(struct net_device
> > *dev)
> >
> > {
> >
> > memcpy(dev->dev_addr,
> >
> > (*(struct rtnet_device **)netdev_priv(dev))->dev_addr,
> >
> > - sizeof(dev->dev_addr));
> > + MAX_ADDR_LEN);
> >
> > return 0;
> >
> > }
>
> Good catch. Looks like there could be more regressions (git grep
> "sizeof.*dev_addr"). Could you check/fix them as well?
New patch sent. Two additional locations were affected.
--
Sebastian
|