summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/virtio_net.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index c501b5974aee..cc79343cd220 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -3177,12 +3177,16 @@ static int virtnet_probe(struct virtio_device *vdev)
dev->max_mtu = MAX_MTU;
/* Configuration may specify what MAC to use. Otherwise random. */
- if (virtio_has_feature(vdev, VIRTIO_NET_F_MAC))
+ if (virtio_has_feature(vdev, VIRTIO_NET_F_MAC)) {
+ u8 addr[ETH_ALEN];
+
virtio_cread_bytes(vdev,
offsetof(struct virtio_net_config, mac),
- dev->dev_addr, dev->addr_len);
- else
+ addr, ETH_ALEN);
+ eth_hw_addr_set(dev, addr);
+ } else {
eth_hw_addr_random(dev);
+ }
/* Set up our device-specific information */
vi = netdev_priv(dev);