Skip to contentSkip to conversation

sis900: print warning if MAC address is not available

PATCH In review Daniele Venzano 2 participants 3 messages Dec 30, 2009 – Jan 4, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sis900: print warning if MAC address is not available

The attached patch prints a warning if the MAC address is all 0s in the sis900 driver.

The patch prints a warning whenever the MAC address read from the hardware is composed of all zeros.
If the address cannot be read at all for some reason, the driver is already doing the right thing and bails out.
In reference to bug 11649 from bugzilla.

Please test this patch, it is trivial, but I only test-compiled it since I no longer have the hardware.

drivers/net/sis900.c +22 -0
@@ -382,6 +382,25 @@ static int __devinit sis96x_get_mac_addr
 }
 
 /**
+ *      sis900_check_mac_addr - Check the MAc adress for validity
+ *	@net_dev: the net device that has the address to check
+ *
+ * 	Return false (0) if the mac address read from the hardware is
+ * 	composed of all zeros.
+ */
+
+static int __devinit sis900_check_mac_addr(struct net_device *net_dev)
+{
+	int i;
+
+	for (i = 0; i < 6; i++)
+		if (net_dev->dev_addr[i] != 0)
+			return 1;
+
+	return 0;
+}
+
+/**
  *	sis900_probe - Probe for sis900 device
  *	@pci_dev: the sis900 pci device
  *	@pci_id: the pci device ID
@@ -504,6 +523,9 @@ static int __devinit sis900_probe(struct
 	else
 		ret = sis900_get_mac_addr(pci_dev, net_dev);
 
+	if (sis900_check_mac_addr(net_dev) == 0)
+		printk(KERN_WARNING "%s: Read an invalid MAC address, remember to set one manually\n", dev_name);
+
 	if (ret == 0) {
 		printk(KERN_WARNING "%s: Cannot read MAC address.\n", dev_name);
 		ret = -ENODEV;
maintainer
#1 lore raw

From: Daniele Venzano <[email protected]>
Date: Wed, 30 Dec 2009 19:22:43 +0100

Quoted 9 lines

The attached patch prints a warning if the MAC address is all 0s in the sis900 driver.

The patch prints a warning whenever the MAC address read from the hardware is composed of all zeros.
If the address cannot be read at all for some reason, the driver is already doing the right thing and bails out.
In reference to bug 11649 from bugzilla.

Quoted 4 lines

Please test this patch, it is trivial, but I only test-compiled it since I no longer have the hardware.

We have a way to check for a valid mac address: is_valid_ether_addr()

Please use it instead of your home-grown function.

#2 lore raw

Your mail DID ring a bell...

The correct patch already got in at the beginning of last year in commit d1d5e6b1cead3df6f722d1d458874bd7f93da8d6.

Closing related bugs, sorry for the noise.

----- Message d'origine -----
De: David Miller <[email protected]>
Date: Sun, 03 Jan 2010 21:57:27 -0800 (PST)
Sujet: Re: [PATCH] sis900: print warning if MAC address is not available

Quoted 11 lines

From: Daniele Venzano <[email protected]>
Date: Wed, 30 Dec 2009 19:22:43 +0100

Quoted 8 lines

The attached patch prints a warning if the MAC address is all 0s in the sis900 driver.

The patch prints a warning whenever the MAC address read from the hardware is composed of all zeros.
If the address cannot be read at all for some reason, the driver is already doing the right thing and bails out.
In reference to bug 11649 from bugzilla.

--
Daniele Venzano
[email protected]
http://www.brownhat.org