aboutsummaryrefslogtreecommitdiffstats
path: root/net/wanrouter
diff options
context:
space:
mode:
authorPanagiotis Issaris <takis@issaris.org>2006-07-21 17:51:30 -0400
committerDavid S. Miller <davem@davemloft.net>2006-07-21 17:51:30 -0400
commit0da974f4f303a6842516b764507e3c0a03f41e5a (patch)
tree8872aec792f02040269c6769dd1009b20f71d186 /net/wanrouter
parenta0ee7c70b22f78593957f99faa06acb4747b8bc0 (diff)
[NET]: Conversions from kmalloc+memset to k(z|c)alloc.
Signed-off-by: Panagiotis Issaris <takis@issaris.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/wanrouter')
-rw-r--r--net/wanrouter/af_wanpipe.c9
-rw-r--r--net/wanrouter/wanmain.c9
2 files changed, 6 insertions, 12 deletions
diff --git a/net/wanrouter/af_wanpipe.c b/net/wanrouter/af_wanpipe.c
index a690cf773b6a..6f39faa15832 100644
--- a/net/wanrouter/af_wanpipe.c
+++ b/net/wanrouter/af_wanpipe.c
@@ -370,12 +370,11 @@ static int wanpipe_listen_rcv (struct sk_buff *skb, struct sock *sk)
370 * used by the ioctl call to read call information 370 * used by the ioctl call to read call information
371 * and to execute commands. 371 * and to execute commands.
372 */ 372 */
373 if ((mbox_ptr = kmalloc(sizeof(mbox_cmd_t), GFP_ATOMIC)) == NULL) { 373 if ((mbox_ptr = kzalloc(sizeof(mbox_cmd_t), GFP_ATOMIC)) == NULL) {
374 wanpipe_kill_sock_irq (newsk); 374 wanpipe_kill_sock_irq (newsk);
375 release_device(dev); 375 release_device(dev);
376 return -ENOMEM; 376 return -ENOMEM;
377 } 377 }
378 memset(mbox_ptr, 0, sizeof(mbox_cmd_t));
379 memcpy(mbox_ptr,skb->data,skb->len); 378 memcpy(mbox_ptr,skb->data,skb->len);
380 379
381 /* Register the lcn on which incoming call came 380 /* Register the lcn on which incoming call came
@@ -507,11 +506,10 @@ static struct sock *wanpipe_alloc_socket(void)
507 if ((sk = sk_alloc(PF_WANPIPE, GFP_ATOMIC, &wanpipe_proto, 1)) == NULL) 506 if ((sk = sk_alloc(PF_WANPIPE, GFP_ATOMIC, &wanpipe_proto, 1)) == NULL)
508 return NULL; 507 return NULL;
509 508
510 if ((wan_opt = kmalloc(sizeof(struct wanpipe_opt), GFP_ATOMIC)) == NULL) { 509 if ((wan_opt = kzalloc(sizeof(struct wanpipe_opt), GFP_ATOMIC)) == NULL) {
511 sk_free(sk); 510 sk_free(sk);
512 return NULL; 511 return NULL;
513 } 512 }
514 memset(wan_opt, 0x00, sizeof(struct wanpipe_opt));
515 513
516 wp_sk(sk) = wan_opt; 514 wp_sk(sk) = wan_opt;
517 515
@@ -2011,10 +2009,9 @@ static int set_ioctl_cmd (struct sock *sk, void *arg)
2011 2009
2012 dev_put(dev); 2010 dev_put(dev);
2013 2011
2014 if ((mbox_ptr = kmalloc(sizeof(mbox_cmd_t), GFP_ATOMIC)) == NULL) 2012 if ((mbox_ptr = kzalloc(sizeof(mbox_cmd_t), GFP_ATOMIC)) == NULL)
2015 return -ENOMEM; 2013 return -ENOMEM;
2016 2014
2017 memset(mbox_ptr, 0, sizeof(mbox_cmd_t));
2018 wp_sk(sk)->mbox = mbox_ptr; 2015 wp_sk(sk)->mbox = mbox_ptr;
2019 2016
2020 wanpipe_link_driver(dev,sk); 2017 wanpipe_link_driver(dev,sk);
diff --git a/net/wanrouter/wanmain.c b/net/wanrouter/wanmain.c
index ad8e8a797790..9479659277ae 100644
--- a/net/wanrouter/wanmain.c
+++ b/net/wanrouter/wanmain.c
@@ -642,18 +642,16 @@ static int wanrouter_device_new_if(struct wan_device *wandev,
642 642
643 if (cnf->config_id == WANCONFIG_MPPP) { 643 if (cnf->config_id == WANCONFIG_MPPP) {
644#ifdef CONFIG_WANPIPE_MULTPPP 644#ifdef CONFIG_WANPIPE_MULTPPP
645 pppdev = kmalloc(sizeof(struct ppp_device), GFP_KERNEL); 645 pppdev = kzalloc(sizeof(struct ppp_device), GFP_KERNEL);
646 err = -ENOBUFS; 646 err = -ENOBUFS;
647 if (pppdev == NULL) 647 if (pppdev == NULL)
648 goto out; 648 goto out;
649 memset(pppdev, 0, sizeof(struct ppp_device)); 649 pppdev->dev = kzalloc(sizeof(struct net_device), GFP_KERNEL);
650 pppdev->dev = kmalloc(sizeof(struct net_device), GFP_KERNEL);
651 if (pppdev->dev == NULL) { 650 if (pppdev->dev == NULL) {
652 kfree(pppdev); 651 kfree(pppdev);
653 err = -ENOBUFS; 652 err = -ENOBUFS;
654 goto out; 653 goto out;
655 } 654 }
656 memset(pppdev->dev, 0, sizeof(struct net_device));
657 err = wandev->new_if(wandev, (struct net_device *)pppdev, cnf); 655 err = wandev->new_if(wandev, (struct net_device *)pppdev, cnf);
658 dev = pppdev->dev; 656 dev = pppdev->dev;
659#else 657#else
@@ -663,11 +661,10 @@ static int wanrouter_device_new_if(struct wan_device *wandev,
663 goto out; 661 goto out;
664#endif 662#endif
665 } else { 663 } else {
666 dev = kmalloc(sizeof(struct net_device), GFP_KERNEL); 664 dev = kzalloc(sizeof(struct net_device), GFP_KERNEL);
667 err = -ENOBUFS; 665 err = -ENOBUFS;
668 if (dev == NULL) 666 if (dev == NULL)
669 goto out; 667 goto out;
670 memset(dev, 0, sizeof(struct net_device));
671 err = wandev->new_if(wandev, dev, cnf); 668 err = wandev->new_if(wandev, dev, cnf);
672 } 669 }
673 670