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/bridge | |
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/bridge')
-rw-r--r-- | net/bridge/br_ioctl.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/net/bridge/br_ioctl.c b/net/bridge/br_ioctl.c index 159fb8409824..4e4119a12139 100644 --- a/net/bridge/br_ioctl.c +++ b/net/bridge/br_ioctl.c | |||
@@ -162,12 +162,10 @@ static int old_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
162 | if (num > BR_MAX_PORTS) | 162 | if (num > BR_MAX_PORTS) |
163 | num = BR_MAX_PORTS; | 163 | num = BR_MAX_PORTS; |
164 | 164 | ||
165 | indices = kmalloc(num*sizeof(int), GFP_KERNEL); | 165 | indices = kcalloc(num, sizeof(int), GFP_KERNEL); |
166 | if (indices == NULL) | 166 | if (indices == NULL) |
167 | return -ENOMEM; | 167 | return -ENOMEM; |
168 | 168 | ||
169 | memset(indices, 0, num*sizeof(int)); | ||
170 | |||
171 | get_port_ifindices(br, indices, num); | 169 | get_port_ifindices(br, indices, num); |
172 | if (copy_to_user((void __user *)args[1], indices, num*sizeof(int))) | 170 | if (copy_to_user((void __user *)args[1], indices, num*sizeof(int))) |
173 | num = -EFAULT; | 171 | num = -EFAULT; |
@@ -327,11 +325,10 @@ static int old_deviceless(void __user *uarg) | |||
327 | 325 | ||
328 | if (args[2] >= 2048) | 326 | if (args[2] >= 2048) |
329 | return -ENOMEM; | 327 | return -ENOMEM; |
330 | indices = kmalloc(args[2]*sizeof(int), GFP_KERNEL); | 328 | indices = kcalloc(args[2], sizeof(int), GFP_KERNEL); |
331 | if (indices == NULL) | 329 | if (indices == NULL) |
332 | return -ENOMEM; | 330 | return -ENOMEM; |
333 | 331 | ||
334 | memset(indices, 0, args[2]*sizeof(int)); | ||
335 | args[2] = get_bridge_ifindices(indices, args[2]); | 332 | args[2] = get_bridge_ifindices(indices, args[2]); |
336 | 333 | ||
337 | ret = copy_to_user((void __user *)args[1], indices, args[2]*sizeof(int)) | 334 | ret = copy_to_user((void __user *)args[1], indices, args[2]*sizeof(int)) |