From 64c8376396fb25e3859c7087c5316758d0a6bc9b Mon Sep 17 00:00:00 2001 From: Alexey Dobriyan Date: Fri, 18 Apr 2008 15:43:32 -0700 Subject: [PATCH] --- yaml --- r: 90899 b: refs/heads/master c: d1643d24c61b725bef399cc1cf2944b4c9c23177 h: refs/heads/master i: 90897: bbb05aa1e130c351b2ae66beaa9f47b8819e2e5f 90895: bb9ae072d9659b949b56e7cb195243ae2d5a6384 v: v3 --- [refs] | 2 +- trunk/net/core/dev.c | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index 5ca84e4a1297..3fd47e4f83b2 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 3c051235a7f115c34e675c9cf55820bd3435f860 +refs/heads/master: d1643d24c61b725bef399cc1cf2944b4c9c23177 diff --git a/trunk/net/core/dev.c b/trunk/net/core/dev.c index c16a07fde388..e1df1ab3e04a 100644 --- a/trunk/net/core/dev.c +++ b/trunk/net/core/dev.c @@ -3996,12 +3996,15 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name, BUG_ON(strlen(name) >= sizeof(dev->name)); - /* ensure 32-byte alignment of both the device and private area */ - alloc_size = (sizeof(*dev) + NETDEV_ALIGN_CONST + - (sizeof(struct net_device_subqueue) * (queue_count - 1))) & - ~NETDEV_ALIGN_CONST; - if (sizeof_priv) - alloc_size += sizeof_priv + NETDEV_ALIGN_CONST; + alloc_size = sizeof(struct net_device) + + sizeof(struct net_device_subqueue) * (queue_count - 1); + if (sizeof_priv) { + /* ensure 32-byte alignment of private area */ + alloc_size = (alloc_size + NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST; + alloc_size += sizeof_priv; + } + /* ensure 32-byte alignment of whole construct */ + alloc_size += NETDEV_ALIGN_CONST; p = kzalloc(alloc_size, GFP_KERNEL); if (!p) {