aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/core/dev.c9
-rw-r--r--net/mac80211/main.c8
2 files changed, 6 insertions, 11 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index ed4550fd9ece..32ceee17896e 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4988,18 +4988,18 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
4988 struct netdev_queue *tx; 4988 struct netdev_queue *tx;
4989 struct net_device *dev; 4989 struct net_device *dev;
4990 size_t alloc_size; 4990 size_t alloc_size;
4991 void *p; 4991 struct net_device *p;
4992 4992
4993 BUG_ON(strlen(name) >= sizeof(dev->name)); 4993 BUG_ON(strlen(name) >= sizeof(dev->name));
4994 4994
4995 alloc_size = sizeof(struct net_device); 4995 alloc_size = sizeof(struct net_device);
4996 if (sizeof_priv) { 4996 if (sizeof_priv) {
4997 /* ensure 32-byte alignment of private area */ 4997 /* ensure 32-byte alignment of private area */
4998 alloc_size = (alloc_size + NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST; 4998 alloc_size = ALIGN(alloc_size, NETDEV_ALIGN);
4999 alloc_size += sizeof_priv; 4999 alloc_size += sizeof_priv;
5000 } 5000 }
5001 /* ensure 32-byte alignment of whole construct */ 5001 /* ensure 32-byte alignment of whole construct */
5002 alloc_size += NETDEV_ALIGN_CONST; 5002 alloc_size += NETDEV_ALIGN - 1;
5003 5003
5004 p = kzalloc(alloc_size, GFP_KERNEL); 5004 p = kzalloc(alloc_size, GFP_KERNEL);
5005 if (!p) { 5005 if (!p) {
@@ -5014,8 +5014,7 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
5014 goto free_p; 5014 goto free_p;
5015 } 5015 }
5016 5016
5017 dev = (struct net_device *) 5017 dev = PTR_ALIGN(p, NETDEV_ALIGN);
5018 (((long)p + NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST);
5019 dev->padded = (char *)dev - (char *)p; 5018 dev->padded = (char *)dev - (char *)p;
5020 5019
5021 if (dev_addr_init(dev)) 5020 if (dev_addr_init(dev))
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 6b7e92eaab47..e37770ced53c 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -735,9 +735,7 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
735 * +-------------------------+ 735 * +-------------------------+
736 * 736 *
737 */ 737 */
738 priv_size = ((sizeof(struct ieee80211_local) + 738 priv_size = ALIGN(sizeof(*local), NETDEV_ALIGN) + priv_data_len;
739 NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST) +
740 priv_data_len;
741 739
742 wiphy = wiphy_new(&mac80211_config_ops, priv_size); 740 wiphy = wiphy_new(&mac80211_config_ops, priv_size);
743 741
@@ -754,9 +752,7 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
754 752
755 local->hw.wiphy = wiphy; 753 local->hw.wiphy = wiphy;
756 754
757 local->hw.priv = (char *)local + 755 local->hw.priv = (char *)local + ALIGN(sizeof(*local), NETDEV_ALIGN);
758 ((sizeof(struct ieee80211_local) +
759 NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST);
760 756
761 BUG_ON(!ops->tx); 757 BUG_ON(!ops->tx);
762 BUG_ON(!ops->start); 758 BUG_ON(!ops->start);