netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: use kcalloc in netdev_queue alloc
@ 2008-07-21 18:19 Stephen Hemminger
  2008-07-21 20:28 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Hemminger @ 2008-07-21 18:19 UTC (permalink / raw)
  To: David Miller, netdev

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

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/net/core/dev.c	2008-07-21 11:13:29.000000000 -0700
+++ b/net/core/dev.c	2008-07-21 11:15:12.000000000 -0700
@@ -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");

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: use kcalloc in netdev_queue alloc
  2008-07-21 18:19 [PATCH] net: use kcalloc in netdev_queue alloc Stephen Hemminger
@ 2008-07-21 20:28 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2008-07-21 20:28 UTC (permalink / raw)
  To: shemminger; +Cc: netdev

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Mon, 21 Jul 2008 11:19:33 -0700

> Minor nit, use size_t for allocation size and kcalloc to allocate
> an array. Probably makes no actual code difference.
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

Looks good, applied.

Thanks Stephen.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-07-21 20:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-21 18:19 [PATCH] net: use kcalloc in netdev_queue alloc Stephen Hemminger
2008-07-21 20:28 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).