diff options
Diffstat (limited to 'net/ipv4/ipvs')
-rw-r--r-- | net/ipv4/ipvs/ip_vs_ctl.c | 10 | ||||
-rw-r--r-- | net/ipv4/ipvs/ip_vs_est.c | 3 |
2 files changed, 4 insertions, 9 deletions
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; |