ibmveth gcc 3.5 issues

Anton Blanchard anton at samba.org
Tue Apr 13 20:52:18 EST 2004


Hi,

gcc 3.5 doesnt like the mac_addr_p gymnastics and it has the potential
to explode if phyp feeds us a bogus mac address. The change was based on
the comment above it, can someone verify the new version will work as
expected?

Anton

diff -puN drivers/net/ibmveth.c~gcc-3.5fixes drivers/net/ibmveth.c
--- foobar2/drivers/net/ibmveth.c~gcc-3.5fixes	2004-03-01 12:40:37.445129353 +1100
+++ foobar2-anton/drivers/net/ibmveth.c	2004-03-01 12:43:51.646252905 +1100
@@ -865,14 +865,14 @@ static int __devinit ibmveth_probe(struc
 	struct net_device *netdev;
 	struct ibmveth_adapter *adapter;

-	unsigned int *mac_addr_p;
+	unsigned char *mac_addr_p;
 	unsigned int *mcastFilterSize_p;


 	ibmveth_debug_printk_no_adapter("entering ibmveth_probe for UA 0x%x\n",
 					dev->unit_address);

-	mac_addr_p = (unsigned int *) vio_get_attribute(dev, VETH_MAC_ADDR, 0);
+	mac_addr_p = (unsigned char *) vio_get_attribute(dev, VETH_MAC_ADDR, 0);
 	if(!mac_addr_p) {
 		ibmveth_error_printk("Can't find VETH_MAC_ADDR attribute\n");
 		return 0;
@@ -907,8 +907,8 @@ static int __devinit ibmveth_probe(struc
 		The RPA doc specifies that the first byte must be 10b, so
 		we'll just look for it to solve this 8 vs. 6 byte field issue */

-	while (*((char*)mac_addr_p) != (char)(0x02))
-		((char*)mac_addr_p)++;
+	if (*mac_addr_p != 0x02)
+		mac_addr_p += 2;

 	adapter->mac_addr = 0;
 	memcpy(&adapter->mac_addr, mac_addr_p, 6);

_

** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc64-dev mailing list