On Sun, Jul 24, 2011 at 9:43 PM, <rpear...@systemfabricworks.com> wrote: +static __be64 rxe_mac_to_eui64(struct net_device *ndev) +{ + unsigned char *mac_addr = ndev->dev_addr; + __be64 eui64; + unsigned char *dst = (unsigned char *)&eui64; + + dst[0] = mac_addr[0] ^ 2; + dst[1] = mac_addr[1]; + dst[2] = mac_addr[2]; + dst[3] = 0xff; + dst[4] = 0xfe; + dst[5] = mac_addr[3]; + dst[6] = mac_addr[4]; + dst[7] = mac_addr[5]; + + return eui64; +}
As far as I can see rxe_param_set_add() does not limit ndev to Ethernet devices ? In that case my comments about the above code are as follows: * The name mac_addr is misleading - dev_addr is probably more appropriate. * A device address length check is missing. For network devices with addresses less than six bytes long the above code will trigger an out-of-bounds read. * If someone binds ib_rxe to a network device with an address length above six bytes, some useful information will be discarded. Bart. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html