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 <[email protected]>
> ---
>  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?

TIA,
Jan

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux

------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
RTnet-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rtnet-developers

Reply via email to