Better calculation of alignment of structures. In theory, it was possible that some structures might overlap (it didn't really happen as compiler does its own structure alignment). Moreover, pointer arithmetic can be used to get from ieee80211_sub_if_data to net_device now. Signed-off-by: Jiri Benc Index: netdev/net/ieee80211/ieee80211.c =================================================================== --- netdev.orig/net/ieee80211/ieee80211.c 2006-01-06 17:05:10.000000000 +0100 +++ netdev/net/ieee80211/ieee80211.c 2006-01-09 17:53:07.000000000 +0100 @@ -4405,20 +4405,18 @@ struct net_device *ieee80211_alloc_hw(si return NULL; mdev->priv = (struct net_device *) - (((long) mdev + - sizeof(struct net_device) + - sizeof(struct ieee80211_sub_if_data) + 3) - & ~3); + ((char *) mdev + + ((sizeof(struct net_device) + 3) & ~3) + + ((sizeof(struct ieee80211_sub_if_data) + 3) & ~3)); local = mdev->priv; local->hw_priv = (void *) - (((long) local + sizeof(struct ieee80211_local) + 3) & ~3); + ((char *) local + ((sizeof(struct ieee80211_local) + 3) & ~3)); apdev = (struct net_device *) - (((long) local->hw_priv + priv_data_len + 3) & ~3); + ((char *) local->hw_priv + ((priv_data_len + 3) & ~3)); dev = (struct net_device *) - (((long) apdev + - sizeof(struct net_device) + - sizeof(struct ieee80211_sub_if_data) + 3) - & ~3); + ((char *) apdev + + ((sizeof(struct net_device) + 3) & ~3) + + ((sizeof(struct ieee80211_sub_if_data) + 3) & ~3)); dev->priv = local; ether_setup(dev); @@ -4490,7 +4488,7 @@ struct net_device *ieee80211_alloc_hw(si goto fail; apdev = (struct net_device *) - (((long) local->hw_priv + priv_data_len + 3) & ~3); + ((char *) local->hw_priv + ((priv_data_len + 3) & ~3)); local->apdev = apdev; ether_setup(apdev); apdev->priv = local; Index: netdev/net/ieee80211/ieee80211_i.h =================================================================== --- netdev.orig/net/ieee80211/ieee80211_i.h 2006-01-06 19:24:00.000000000 +0100 +++ netdev/net/ieee80211/ieee80211_i.h 2006-01-09 17:51:44.000000000 +0100 @@ -288,7 +288,9 @@ struct ieee80211_sub_if_data { }; #define IEEE80211_DEV_TO_SUB_IF(dev) ((struct ieee80211_sub_if_data *) \ - (((long)dev + sizeof(struct net_device) + 3) & ~3)) + ((char *)(dev) + ((sizeof(struct net_device) + 3) & ~3))) +#define IEEE80211_SUB_IF_TO_DEV(sub_if) ((struct net_device *) \ + ((char *)(sub_if) - ((sizeof(struct net_device) + 3) & ~3))) struct ieee80211_local {