lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20081208145214.GA6830@ubuntu>
Date:	Mon, 8 Dec 2008 22:52:14 +0800
From:	Jianjun Kong <jianjun@...ux.org>
To:	"David S. Miller" <davem@...emloft.net>
Cc:	netdev <netdev@...r.kernel.org>
Subject: [PATCH] net: cleanup for net/core/dev.c


net/core/dev.c:
netdev_priv() do the same thing like

dev->priv = ((char *)dev +
	((sizeof(struct net_device) + NETDEV_ALIGN_CONST)
	& ~NETDEV_ALIGN_CONST));

Signed-off-by: Jianjun Kong <jianjun@...ux.org>
---
 net/core/dev.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 9174c77..f6d9af5 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4305,7 +4305,7 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
 	size_t alloc_size;
 	void *p;
 
-	BUG_ON(strlen(name) >= sizeof(dev->name));
+	BUG_ON(strlen(name) >= IFNAMSIZ);
 
 	alloc_size = sizeof(struct net_device);
 	if (sizeof_priv) {
@@ -4339,11 +4339,8 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
 	dev->num_tx_queues = queue_count;
 	dev->real_num_tx_queues = queue_count;
 
-	if (sizeof_priv) {
-		dev->priv = ((char *)dev +
-			     ((sizeof(struct net_device) + NETDEV_ALIGN_CONST)
-			      & ~NETDEV_ALIGN_CONST));
-	}
+	if (sizeof_priv)
+		dev->priv = netdev_priv(dev);
 
 	dev->gso_max_size = GSO_MAX_SIZE;
 
-- 
1.5.6.3

-- 
Jianjun Kong |Happy Hacking
Homepage: http://kongove.cn
Gtalk:kongjianjun@...il.com
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ