Skip to contentSkip to conversation

net: use kcalloc in netdev_queue alloc

PATCH In review Stephen Hemminger 2 participants 2 messages Jul 21, 2008

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

PATCH 1/1 net: use kcalloc in netdev_queue alloc

Minor nit, use size_t for allocation size and kcalloc to allocate an array. Probably makes no actual code difference.

net/core/dev.c +2 -2
@@ -4198,7 +4198,7 @@ struct net_device *alloc_netdev_mq(int s
 {
 	struct netdev_queue *tx;
 	struct net_device *dev;
-	int alloc_size;
+	size_t alloc_size;
 	void *p;
 
 	BUG_ON(strlen(name) >= sizeof(dev->name));
@@ -4218,7 +4218,7 @@ struct net_device *alloc_netdev_mq(int s
 		return NULL;
 	}
 
-	tx = kzalloc(sizeof(struct netdev_queue) * queue_count, GFP_KERNEL);
+	tx = kcalloc(queue_count, sizeof(struct netdev_queue), GFP_KERNEL);
 	if (!tx) {
 		printk(KERN_ERR "alloc_netdev: Unable to allocate "
 		       "tx qdiscs.\n");