Skip to contentSkip to conversation

net: use 32-bit arithmetic while allocating net device

PATCH Applied Alexey Dobriyan 2 participants 2 messages Sep 21, 2017 – Sep 23, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: use 32-bit arithmetic while allocating net device

Private part of allocation is never big enough to warrant size_t.

Space savings:

add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-10 (-10)
function old new delta
alloc_netdev_mqs 1120 1110 -10

---

 net/core/dev.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/dev.c +1 -1
@@ -7989,7 +7989,7 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
 		unsigned int txqs, unsigned int rxqs)
 {
 	struct net_device *dev;
-	size_t alloc_size;
+	unsigned int alloc_size;
 	struct net_device *p;
 
 	BUG_ON(strlen(name) >= sizeof(dev->name));
maintainer Applied
#1 lore raw

From: Alexey Dobriyan <[email protected]>
Date: Thu, 21 Sep 2017 23:33:29 +0300

Quoted 9 lines

Private part of allocation is never big enough to warrant size_t.

Space savings:

add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-10 (-10)
function old new delta
alloc_netdev_mqs 1120 1110 -10

Applied to net-next.