Re: [PATCH] staging: slicoss: Fix prefer ether_addr_copy over memcpy

From: Joel Pelaez Jorge
Date: Tue Mar 18 2014 - 19:08:42 EST


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


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/