patch-2.4.6 linux/net/atm/common.c
Next file: linux/net/atm/lec.c
Previous file: linux/net/atm/clip.c
Back to the patch index
Back to the overall index
- Lines: 30
- Date:
Wed Jun 27 17:10:55 2001
- Orig file:
v2.4.5/linux/net/atm/common.c
- Orig date:
Fri Apr 6 10:51:19 2001
diff -u --recursive --new-file v2.4.5/linux/net/atm/common.c linux/net/atm/common.c
@@ -544,7 +544,7 @@
{
struct atm_dev *dev;
struct atm_vcc *vcc;
- int *tmp_buf;
+ int *tmp_buf, *tmp_p;
void *buf;
int error,len,size,number, ret_val;
@@ -598,14 +598,13 @@
ret_val = -ENOMEM;
goto done;
}
+ tmp_p = tmp_buf;
for (dev = atm_devs; dev; dev = dev->next)
- *tmp_buf++ = dev->number;
- if (copy_to_user(buf,(char *) tmp_buf-size,size)) {
- ret_val = -EFAULT;
- goto done;
- }
- ret_val = put_user(size,
- &((struct atm_iobuf *) arg)->length) ? -EFAULT : 0;
+ *tmp_p++ = dev->number;
+ ret_val = ((copy_to_user(buf, tmp_buf, size)) ||
+ put_user(size, &((struct atm_iobuf *) arg)->length)
+ ) ? -EFAULT : 0;
+ kfree(tmp_buf);
goto done;
case SIOCGSTAMP: /* borrowed from IP */
if (!vcc->timestamp.tv_sec) {
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)