diff options
Diffstat (limited to 'net/bridge/br_ioctl.c')
| -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)) |
