[PATCH] staging: slicoss: Fix prefer ether_addr_copy over memcpy
Joel Pelaez Jorge
joelpelaez at gmail.com
Tue Mar 18 23:08:31 UTC 2014
El 17/03/14 23:49, Jingoo Han escribió:
> On Tuesday, March 18, 2014 2:04 PM, Joel Pelaez Jorge wrote:
>>
>>
>> @@ -810,8 +810,8 @@ static int slic_mac_set_address(struct net_device
>> *dev, void *ptr)
>> if (!is_valid_ether_addr(addr->sa_data))
>> return -EINVAL;
>>
>> - memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
>> - memcpy(adapter->currmacaddr, addr->sa_data, dev->addr_len);
>> + ether_addr_copy(dev->dev_addr, addr->sa_data);
>> + ether_addr_copy(adapter->currmacaddr, addr->sa_data);
>
> By the way, I am wondering if 'dev->addr_len' is 6 bytes.
> Is there anyone who can confirm it?
>
> If nobody can confirm 'dev->addr_len' is 6 bytes, it should
> not be changed to 'ether_addr_copy()'.
>
> Best regards,
> Jingoo Han
>
In the first case, is necessary use memcpy for copy te ethernet address
to dev->dev_addr because this is a pointer, uses dev->addr_len for
define size.
But in the second, adapter->currmacaddr is fixed to 6 size, so that here
one can use ether_addr_copy without issues.
--
Best regards,
Joel Pelaez Jorge
Joel Pelaez Jorge
More information about the devel
mailing list