diff options
author | Panagiotis Issaris <takis@issaris.org> | 2006-07-21 17:51:30 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-07-21 17:51:30 -0400 |
commit | 0da974f4f303a6842516b764507e3c0a03f41e5a (patch) | |
tree | 8872aec792f02040269c6769dd1009b20f71d186 /net/ipv4 | |
parent | a0ee7c70b22f78593957f99faa06acb4747b8bc0 (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/ipv4')
-rw-r--r-- | net/ipv4/ah4.c | 4 | ||||
-rw-r--r-- | net/ipv4/arp.c | 3 | ||||
-rw-r--r-- | net/ipv4/devinet.c | 6 | ||||
-rw-r--r-- | net/ipv4/esp4.c | 4 | ||||
-rw-r--r-- | net/ipv4/fib_hash.c | 6 | ||||
-rw-r--r-- | net/ipv4/fib_rules.c | 3 | ||||
-rw-r--r-- | net/ipv4/fib_semantics.c | 3 | ||||
-rw-r--r-- | net/ipv4/igmp.c | 12 | ||||
-rw-r--r-- | net/ipv4/inet_diag.c | 3 | ||||
-rw-r--r-- | net/ipv4/ipcomp.c | 3 | ||||
-rw-r--r-- | net/ipv4/ipvs/ip_vs_ctl.c | 10 | ||||
-rw-r--r-- | net/ipv4/ipvs/ip_vs_est.c | 3 | ||||
-rw-r--r-- | net/ipv4/netfilter/ipt_CLUSTERIP.c | 3 | ||||
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 3 | ||||
-rw-r--r-- | net/ipv4/udp.c | 3 |
15 files changed, 22 insertions, 47 deletions
diff --git a/net/ipv4/ah4.c b/net/ipv4/ah4.c index 8e748be36c5a..1366bc6ce6a5 100644 --- a/net/ipv4/ah4.c +++ b/net/ipv4/ah4.c | |||
@@ -215,12 +215,10 @@ static int ah_init_state(struct xfrm_state *x) | |||
215 | if (x->encap) | 215 | if (x->encap) |
216 | goto error; | 216 | goto error; |
217 | 217 | ||
218 | ahp = kmalloc(sizeof(*ahp), GFP_KERNEL); | 218 | ahp = kzalloc(sizeof(*ahp), GFP_KERNEL); |
219 | if (ahp == NULL) | 219 | if (ahp == NULL) |
220 | return -ENOMEM; | 220 | return -ENOMEM; |
221 | 221 | ||
222 | memset(ahp, 0, sizeof(*ahp)); | ||
223 | |||
224 | ahp->key = x->aalg->alg_key; | 222 | ahp->key = x->aalg->alg_key; |
225 | ahp->key_len = (x->aalg->alg_key_len+7)/8; | 223 | ahp->key_len = (x->aalg->alg_key_len+7)/8; |
226 | ahp->tfm = crypto_alloc_tfm(x->aalg->alg_name, 0); | 224 | ahp->tfm = crypto_alloc_tfm(x->aalg->alg_name, 0); |
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index 7b51b3bdb548..c8a3723bc001 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c | |||
@@ -1372,12 +1372,11 @@ static int arp_seq_open(struct inode *inode, struct file *file) | |||
1372 | { | 1372 | { |
1373 | struct seq_file *seq; | 1373 | struct seq_file *seq; |
1374 | int rc = -ENOMEM; | 1374 | int rc = -ENOMEM; |
1375 | struct neigh_seq_state *s = kmalloc(sizeof(*s), GFP_KERNEL); | 1375 | struct neigh_seq_state *s = kzalloc(sizeof(*s), GFP_KERNEL); |
1376 | 1376 | ||
1377 | if (!s) | 1377 | if (!s) |
1378 | goto out; | 1378 | goto out; |
1379 | 1379 | ||
1380 | memset(s, 0, sizeof(*s)); | ||
1381 | rc = seq_open(file, &arp_seq_ops); | 1380 | rc = seq_open(file, &arp_seq_ops); |
1382 | if (rc) | 1381 | if (rc) |
1383 | goto out_kfree; | 1382 | goto out_kfree; |
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index a7c65e9e5ec9..a6cc31d911eb 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -93,10 +93,9 @@ static void devinet_sysctl_unregister(struct ipv4_devconf *p); | |||
93 | 93 | ||
94 | static struct in_ifaddr *inet_alloc_ifa(void) | 94 | static struct in_ifaddr *inet_alloc_ifa(void) |
95 | { | 95 | { |
96 | struct in_ifaddr *ifa = kmalloc(sizeof(*ifa), GFP_KERNEL); | 96 | struct in_ifaddr *ifa = kzalloc(sizeof(*ifa), GFP_KERNEL); |
97 | 97 | ||
98 | if (ifa) { | 98 | if (ifa) { |
99 | memset(ifa, 0, sizeof(*ifa)); | ||
100 | INIT_RCU_HEAD(&ifa->rcu_head); | 99 | INIT_RCU_HEAD(&ifa->rcu_head); |
101 | } | 100 | } |
102 | 101 | ||
@@ -140,10 +139,9 @@ struct in_device *inetdev_init(struct net_device *dev) | |||
140 | 139 | ||
141 | ASSERT_RTNL(); | 140 | ASSERT_RTNL(); |
142 | 141 | ||
143 | in_dev = kmalloc(sizeof(*in_dev), GFP_KERNEL); | 142 | in_dev = kzalloc(sizeof(*in_dev), GFP_KERNEL); |
144 | if (!in_dev) | 143 | if (!in_dev) |
145 | goto out; | 144 | goto out; |
146 | memset(in_dev, 0, sizeof(*in_dev)); | ||
147 | INIT_RCU_HEAD(&in_dev->rcu_head); | 145 | INIT_RCU_HEAD(&in_dev->rcu_head); |
148 | memcpy(&in_dev->cnf, &ipv4_devconf_dflt, sizeof(in_dev->cnf)); | 146 | memcpy(&in_dev->cnf, &ipv4_devconf_dflt, sizeof(in_dev->cnf)); |
149 | in_dev->cnf.sysctl = NULL; | 147 | in_dev->cnf.sysctl = NULL; |
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c index 4e112738b3fa..fc2f8ce441de 100644 --- a/net/ipv4/esp4.c +++ b/net/ipv4/esp4.c | |||
@@ -316,12 +316,10 @@ static int esp_init_state(struct xfrm_state *x) | |||
316 | if (x->ealg == NULL) | 316 | if (x->ealg == NULL) |
317 | goto error; | 317 | goto error; |
318 | 318 | ||
319 | esp = kmalloc(sizeof(*esp), GFP_KERNEL); | 319 | esp = kzalloc(sizeof(*esp), GFP_KERNEL); |
320 | if (esp == NULL) | 320 | if (esp == NULL) |
321 | return -ENOMEM; | 321 | return -ENOMEM; |
322 | 322 | ||
323 | memset(esp, 0, sizeof(*esp)); | ||
324 | |||
325 | if (x->aalg) { | 323 | if (x->aalg) { |
326 | struct xfrm_algo_desc *aalg_desc; | 324 | struct xfrm_algo_desc *aalg_desc; |
327 | 325 | ||
diff --git a/net/ipv4/fib_hash.c b/net/ipv4/fib_hash.c index 3c1d32ad35f2..72c633b357cf 100644 --- a/net/ipv4/fib_hash.c +++ b/net/ipv4/fib_hash.c | |||
@@ -204,11 +204,10 @@ static struct fn_zone * | |||
204 | fn_new_zone(struct fn_hash *table, int z) | 204 | fn_new_zone(struct fn_hash *table, int z) |
205 | { | 205 | { |
206 | int i; | 206 | int i; |
207 | struct fn_zone *fz = kmalloc(sizeof(struct fn_zone), GFP_KERNEL); | 207 | struct fn_zone *fz = kzalloc(sizeof(struct fn_zone), GFP_KERNEL); |
208 | if (!fz) | 208 | if (!fz) |
209 | return NULL; | 209 | return NULL; |
210 | 210 | ||
211 | memset(fz, 0, sizeof(struct fn_zone)); | ||
212 | if (z) { | 211 | if (z) { |
213 | fz->fz_divisor = 16; | 212 | fz->fz_divisor = 16; |
214 | } else { | 213 | } else { |
@@ -1046,7 +1045,7 @@ static int fib_seq_open(struct inode *inode, struct file *file) | |||
1046 | { | 1045 | { |
1047 | struct seq_file *seq; | 1046 | struct seq_file *seq; |
1048 | int rc = -ENOMEM; | 1047 | int rc = -ENOMEM; |
1049 | struct fib_iter_state *s = kmalloc(sizeof(*s), GFP_KERNEL); | 1048 | struct fib_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL); |
1050 | 1049 | ||
1051 | if (!s) | 1050 | if (!s) |
1052 | goto out; | 1051 | goto out; |
@@ -1057,7 +1056,6 @@ static int fib_seq_open(struct inode *inode, struct file *file) | |||
1057 | 1056 | ||
1058 | seq = file->private_data; | 1057 | seq = file->private_data; |
1059 | seq->private = s; | 1058 | seq->private = s; |
1060 | memset(s, 0, sizeof(*s)); | ||
1061 | out: | 1059 | out: |
1062 | return rc; | 1060 | return rc; |
1063 | out_kfree: | 1061 | out_kfree: |
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c index 773b12ba4e3c..79b04718bdfd 100644 --- a/net/ipv4/fib_rules.c +++ b/net/ipv4/fib_rules.c | |||
@@ -196,10 +196,9 @@ int inet_rtm_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) | |||
196 | } | 196 | } |
197 | } | 197 | } |
198 | 198 | ||
199 | new_r = kmalloc(sizeof(*new_r), GFP_KERNEL); | 199 | new_r = kzalloc(sizeof(*new_r), GFP_KERNEL); |
200 | if (!new_r) | 200 | if (!new_r) |
201 | return -ENOMEM; | 201 | return -ENOMEM; |
202 | memset(new_r, 0, sizeof(*new_r)); | ||
203 | 202 | ||
204 | if (rta[RTA_SRC-1]) | 203 | if (rta[RTA_SRC-1]) |
205 | memcpy(&new_r->r_src, RTA_DATA(rta[RTA_SRC-1]), 4); | 204 | memcpy(&new_r->r_src, RTA_DATA(rta[RTA_SRC-1]), 4); |
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index 5f87533684d5..63864bb846e2 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c | |||
@@ -709,11 +709,10 @@ fib_create_info(const struct rtmsg *r, struct kern_rta *rta, | |||
709 | goto failure; | 709 | goto failure; |
710 | } | 710 | } |
711 | 711 | ||
712 | fi = kmalloc(sizeof(*fi)+nhs*sizeof(struct fib_nh), GFP_KERNEL); | 712 | fi = kzalloc(sizeof(*fi)+nhs*sizeof(struct fib_nh), GFP_KERNEL); |
713 | if (fi == NULL) | 713 | if (fi == NULL) |
714 | goto failure; | 714 | goto failure; |
715 | fib_info_cnt++; | 715 | fib_info_cnt++; |
716 | memset(fi, 0, sizeof(*fi)+nhs*sizeof(struct fib_nh)); | ||
717 | 716 | ||
718 | fi->fib_protocol = r->rtm_protocol; | 717 | fi->fib_protocol = r->rtm_protocol; |
719 | 718 | ||
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index d299c8e547d6..9f4b752f5a33 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
@@ -1028,10 +1028,9 @@ static void igmpv3_add_delrec(struct in_device *in_dev, struct ip_mc_list *im) | |||
1028 | * for deleted items allows change reports to use common code with | 1028 | * for deleted items allows change reports to use common code with |
1029 | * non-deleted or query-response MCA's. | 1029 | * non-deleted or query-response MCA's. |
1030 | */ | 1030 | */ |
1031 | pmc = kmalloc(sizeof(*pmc), GFP_KERNEL); | 1031 | pmc = kzalloc(sizeof(*pmc), GFP_KERNEL); |
1032 | if (!pmc) | 1032 | if (!pmc) |
1033 | return; | 1033 | return; |
1034 | memset(pmc, 0, sizeof(*pmc)); | ||
1035 | spin_lock_bh(&im->lock); | 1034 | spin_lock_bh(&im->lock); |
1036 | pmc->interface = im->interface; | 1035 | pmc->interface = im->interface; |
1037 | in_dev_hold(in_dev); | 1036 | in_dev_hold(in_dev); |
@@ -1529,10 +1528,9 @@ static int ip_mc_add1_src(struct ip_mc_list *pmc, int sfmode, | |||
1529 | psf_prev = psf; | 1528 | psf_prev = psf; |
1530 | } | 1529 | } |
1531 | if (!psf) { | 1530 | if (!psf) { |
1532 | psf = kmalloc(sizeof(*psf), GFP_ATOMIC); | 1531 | psf = kzalloc(sizeof(*psf), GFP_ATOMIC); |
1533 | if (!psf) | 1532 | if (!psf) |
1534 | return -ENOBUFS; | 1533 | return -ENOBUFS; |
1535 | memset(psf, 0, sizeof(*psf)); | ||
1536 | psf->sf_inaddr = *psfsrc; | 1534 | psf->sf_inaddr = *psfsrc; |
1537 | if (psf_prev) { | 1535 | if (psf_prev) { |
1538 | psf_prev->sf_next = psf; | 1536 | psf_prev->sf_next = psf; |
@@ -2380,7 +2378,7 @@ static int igmp_mc_seq_open(struct inode *inode, struct file *file) | |||
2380 | { | 2378 | { |
2381 | struct seq_file *seq; | 2379 | struct seq_file *seq; |
2382 | int rc = -ENOMEM; | 2380 | int rc = -ENOMEM; |
2383 | struct igmp_mc_iter_state *s = kmalloc(sizeof(*s), GFP_KERNEL); | 2381 | struct igmp_mc_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL); |
2384 | 2382 | ||
2385 | if (!s) | 2383 | if (!s) |
2386 | goto out; | 2384 | goto out; |
@@ -2390,7 +2388,6 @@ static int igmp_mc_seq_open(struct inode *inode, struct file *file) | |||
2390 | 2388 | ||
2391 | seq = file->private_data; | 2389 | seq = file->private_data; |
2392 | seq->private = s; | 2390 | seq->private = s; |
2393 | memset(s, 0, sizeof(*s)); | ||
2394 | out: | 2391 | out: |
2395 | return rc; | 2392 | return rc; |
2396 | out_kfree: | 2393 | out_kfree: |
@@ -2555,7 +2552,7 @@ static int igmp_mcf_seq_open(struct inode *inode, struct file *file) | |||
2555 | { | 2552 | { |
2556 | struct seq_file *seq; | 2553 | struct seq_file *seq; |
2557 | int rc = -ENOMEM; | 2554 | int rc = -ENOMEM; |
2558 | struct igmp_mcf_iter_state *s = kmalloc(sizeof(*s), GFP_KERNEL); | 2555 | struct igmp_mcf_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL); |
2559 | 2556 | ||
2560 | if (!s) | 2557 | if (!s) |
2561 | goto out; | 2558 | goto out; |
@@ -2565,7 +2562,6 @@ static int igmp_mcf_seq_open(struct inode *inode, struct file *file) | |||
2565 | 2562 | ||
2566 | seq = file->private_data; | 2563 | seq = file->private_data; |
2567 | seq->private = s; | 2564 | seq->private = s; |
2568 | memset(s, 0, sizeof(*s)); | ||
2569 | out: | 2565 | out: |
2570 | return rc; | 2566 | return rc; |
2571 | out_kfree: | 2567 | out_kfree: |
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c index 8e7e41b66c79..492858e6faf0 100644 --- a/net/ipv4/inet_diag.c +++ b/net/ipv4/inet_diag.c | |||
@@ -909,11 +909,10 @@ static int __init inet_diag_init(void) | |||
909 | sizeof(struct inet_diag_handler *)); | 909 | sizeof(struct inet_diag_handler *)); |
910 | int err = -ENOMEM; | 910 | int err = -ENOMEM; |
911 | 911 | ||
912 | inet_diag_table = kmalloc(inet_diag_table_size, GFP_KERNEL); | 912 | inet_diag_table = kzalloc(inet_diag_table_size, GFP_KERNEL); |
913 | if (!inet_diag_table) | 913 | if (!inet_diag_table) |
914 | goto out; | 914 | goto out; |
915 | 915 | ||
916 | memset(inet_diag_table, 0, inet_diag_table_size); | ||
917 | idiagnl = netlink_kernel_create(NETLINK_INET_DIAG, 0, inet_diag_rcv, | 916 | idiagnl = netlink_kernel_create(NETLINK_INET_DIAG, 0, inet_diag_rcv, |
918 | THIS_MODULE); | 917 | THIS_MODULE); |
919 | if (idiagnl == NULL) | 918 | if (idiagnl == NULL) |
diff --git a/net/ipv4/ipcomp.c b/net/ipv4/ipcomp.c index 8a8b5cf2f7fe..a0c28b2b756e 100644 --- a/net/ipv4/ipcomp.c +++ b/net/ipv4/ipcomp.c | |||
@@ -410,11 +410,10 @@ static int ipcomp_init_state(struct xfrm_state *x) | |||
410 | goto out; | 410 | goto out; |
411 | 411 | ||
412 | err = -ENOMEM; | 412 | err = -ENOMEM; |
413 | ipcd = kmalloc(sizeof(*ipcd), GFP_KERNEL); | 413 | ipcd = kzalloc(sizeof(*ipcd), GFP_KERNEL); |
414 | if (!ipcd) | 414 | if (!ipcd) |
415 | goto out; | 415 | goto out; |
416 | 416 | ||
417 | memset(ipcd, 0, sizeof(*ipcd)); | ||
418 | x->props.header_len = 0; | 417 | x->props.header_len = 0; |
419 | if (x->props.mode) | 418 | if (x->props.mode) |
420 | x->props.header_len += sizeof(struct iphdr); | 419 | x->props.header_len += sizeof(struct iphdr); |
diff --git a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c index f28ec6882162..6a28fafe910c 100644 --- a/net/ipv4/ipvs/ip_vs_ctl.c +++ b/net/ipv4/ipvs/ip_vs_ctl.c | |||
@@ -735,12 +735,11 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct ip_vs_dest_user *udest, | |||
735 | if (atype != RTN_LOCAL && atype != RTN_UNICAST) | 735 | if (atype != RTN_LOCAL && atype != RTN_UNICAST) |
736 | return -EINVAL; | 736 | return -EINVAL; |
737 | 737 | ||
738 | dest = kmalloc(sizeof(struct ip_vs_dest), GFP_ATOMIC); | 738 | dest = kzalloc(sizeof(struct ip_vs_dest), GFP_ATOMIC); |
739 | if (dest == NULL) { | 739 | if (dest == NULL) { |
740 | IP_VS_ERR("ip_vs_new_dest: kmalloc failed.\n"); | 740 | IP_VS_ERR("ip_vs_new_dest: kmalloc failed.\n"); |
741 | return -ENOMEM; | 741 | return -ENOMEM; |
742 | } | 742 | } |
743 | memset(dest, 0, sizeof(struct ip_vs_dest)); | ||
744 | 743 | ||
745 | dest->protocol = svc->protocol; | 744 | dest->protocol = svc->protocol; |
746 | dest->vaddr = svc->addr; | 745 | dest->vaddr = svc->addr; |
@@ -1050,14 +1049,12 @@ ip_vs_add_service(struct ip_vs_service_user *u, struct ip_vs_service **svc_p) | |||
1050 | goto out_mod_dec; | 1049 | goto out_mod_dec; |
1051 | } | 1050 | } |
1052 | 1051 | ||
1053 | svc = (struct ip_vs_service *) | 1052 | svc = kzalloc(sizeof(struct ip_vs_service), GFP_ATOMIC); |
1054 | kmalloc(sizeof(struct ip_vs_service), GFP_ATOMIC); | ||
1055 | if (svc == NULL) { | 1053 | if (svc == NULL) { |
1056 | IP_VS_DBG(1, "ip_vs_add_service: kmalloc failed.\n"); | 1054 | IP_VS_DBG(1, "ip_vs_add_service: kmalloc failed.\n"); |
1057 | ret = -ENOMEM; | 1055 | ret = -ENOMEM; |
1058 | goto out_err; | 1056 | goto out_err; |
1059 | } | 1057 | } |
1060 | memset(svc, 0, sizeof(struct ip_vs_service)); | ||
1061 | 1058 | ||
1062 | /* I'm the first user of the service */ | 1059 | /* I'm the first user of the service */ |
1063 | atomic_set(&svc->usecnt, 1); | 1060 | atomic_set(&svc->usecnt, 1); |
@@ -1797,7 +1794,7 @@ static int ip_vs_info_open(struct inode *inode, struct file *file) | |||
1797 | { | 1794 | { |
1798 | struct seq_file *seq; | 1795 | struct seq_file *seq; |
1799 | int rc = -ENOMEM; | 1796 | int rc = -ENOMEM; |
1800 | struct ip_vs_iter *s = kmalloc(sizeof(*s), GFP_KERNEL); | 1797 | struct ip_vs_iter *s = kzalloc(sizeof(*s), GFP_KERNEL); |
1801 | 1798 | ||
1802 | if (!s) | 1799 | if (!s) |
1803 | goto out; | 1800 | goto out; |
@@ -1808,7 +1805,6 @@ static int ip_vs_info_open(struct inode *inode, struct file *file) | |||
1808 | 1805 | ||
1809 | seq = file->private_data; | 1806 | seq = file->private_data; |
1810 | seq->private = s; | 1807 | seq->private = s; |
1811 | memset(s, 0, sizeof(*s)); | ||
1812 | out: | 1808 | out: |
1813 | return rc; | 1809 | return rc; |
1814 | out_kfree: | 1810 | out_kfree: |
diff --git a/net/ipv4/ipvs/ip_vs_est.c b/net/ipv4/ipvs/ip_vs_est.c index 4c1940381ba0..7d68b80c4c19 100644 --- a/net/ipv4/ipvs/ip_vs_est.c +++ b/net/ipv4/ipvs/ip_vs_est.c | |||
@@ -123,11 +123,10 @@ int ip_vs_new_estimator(struct ip_vs_stats *stats) | |||
123 | { | 123 | { |
124 | struct ip_vs_estimator *est; | 124 | struct ip_vs_estimator *est; |
125 | 125 | ||
126 | est = kmalloc(sizeof(*est), GFP_KERNEL); | 126 | est = kzalloc(sizeof(*est), GFP_KERNEL); |
127 | if (est == NULL) | 127 | if (est == NULL) |
128 | return -ENOMEM; | 128 | return -ENOMEM; |
129 | 129 | ||
130 | memset(est, 0, sizeof(*est)); | ||
131 | est->stats = stats; | 130 | est->stats = stats; |
132 | est->last_conns = stats->conns; | 131 | est->last_conns = stats->conns; |
133 | est->cps = stats->cps<<10; | 132 | est->cps = stats->cps<<10; |
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c index cbffeae3f565..d994c5f5744c 100644 --- a/net/ipv4/netfilter/ipt_CLUSTERIP.c +++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c | |||
@@ -172,11 +172,10 @@ clusterip_config_init(struct ipt_clusterip_tgt_info *i, u_int32_t ip, | |||
172 | struct clusterip_config *c; | 172 | struct clusterip_config *c; |
173 | char buffer[16]; | 173 | char buffer[16]; |
174 | 174 | ||
175 | c = kmalloc(sizeof(*c), GFP_ATOMIC); | 175 | c = kzalloc(sizeof(*c), GFP_ATOMIC); |
176 | if (!c) | 176 | if (!c) |
177 | return NULL; | 177 | return NULL; |
178 | 178 | ||
179 | memset(c, 0, sizeof(*c)); | ||
180 | c->dev = dev; | 179 | c->dev = dev; |
181 | c->clusterip = ip; | 180 | c->clusterip = ip; |
182 | memcpy(&c->clustermac, &i->clustermac, ETH_ALEN); | 181 | memcpy(&c->clustermac, &i->clustermac, ETH_ALEN); |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index a891133f00e4..f6f39e814291 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -1640,10 +1640,9 @@ static int tcp_seq_open(struct inode *inode, struct file *file) | |||
1640 | if (unlikely(afinfo == NULL)) | 1640 | if (unlikely(afinfo == NULL)) |
1641 | return -EINVAL; | 1641 | return -EINVAL; |
1642 | 1642 | ||
1643 | s = kmalloc(sizeof(*s), GFP_KERNEL); | 1643 | s = kzalloc(sizeof(*s), GFP_KERNEL); |
1644 | if (!s) | 1644 | if (!s) |
1645 | return -ENOMEM; | 1645 | return -ENOMEM; |
1646 | memset(s, 0, sizeof(*s)); | ||
1647 | s->family = afinfo->family; | 1646 | s->family = afinfo->family; |
1648 | s->seq_ops.start = tcp_seq_start; | 1647 | s->seq_ops.start = tcp_seq_start; |
1649 | s->seq_ops.next = tcp_seq_next; | 1648 | s->seq_ops.next = tcp_seq_next; |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 9bfcddad695b..f136cec96d95 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -1468,11 +1468,10 @@ static int udp_seq_open(struct inode *inode, struct file *file) | |||
1468 | struct udp_seq_afinfo *afinfo = PDE(inode)->data; | 1468 | struct udp_seq_afinfo *afinfo = PDE(inode)->data; |
1469 | struct seq_file *seq; | 1469 | struct seq_file *seq; |
1470 | int rc = -ENOMEM; | 1470 | int rc = -ENOMEM; |
1471 | struct udp_iter_state *s = kmalloc(sizeof(*s), GFP_KERNEL); | 1471 | struct udp_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL); |
1472 | 1472 | ||
1473 | if (!s) | 1473 | if (!s) |
1474 | goto out; | 1474 | goto out; |
1475 | memset(s, 0, sizeof(*s)); | ||
1476 | s->family = afinfo->family; | 1475 | s->family = afinfo->family; |
1477 | s->seq_ops.start = udp_seq_start; | 1476 | s->seq_ops.start = udp_seq_start; |
1478 | s->seq_ops.next = udp_seq_next; | 1477 | s->seq_ops.next = udp_seq_next; |