patch-2.1.129 linux/drivers/char/random.c
Next file: linux/drivers/char/vt.c
Previous file: linux/drivers/char/misc.c
Back to the patch index
Back to the overall index
- Lines: 69
- Date:
Fri Nov 13 10:29:44 1998
- Orig file:
v2.1.128/linux/drivers/char/random.c
- Orig date:
Fri Oct 9 13:27:08 1998
diff -u --recursive --new-file v2.1.128/linux/drivers/char/random.c linux/drivers/char/random.c
@@ -1407,19 +1407,15 @@
switch (cmd) {
case RNDGETENTCNT:
- retval = verify_area(VERIFY_WRITE, (void *) arg, sizeof(int));
- if (retval)
- return(retval);
ent_count = random_state.entropy_count;
- put_user(ent_count, (int *) arg);
+ if (put_user(ent_count, (int *) arg))
+ return -EFAULT;
return 0;
case RNDADDTOENTCNT:
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
- retval = verify_area(VERIFY_READ, (void *) arg, sizeof(int));
- if (retval)
- return(retval);
- get_user(ent_count, (int *) arg);
+ if (get_user(ent_count, (int *) arg))
+ return -EFAULT;
/*
* Add i to entropy_count, limiting the result to be
* between 0 and POOLBITS.
@@ -1446,16 +1442,14 @@
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
p = (int *) arg;
- retval = verify_area(VERIFY_WRITE, (void *) p, sizeof(int));
- if (retval)
- return(retval);
ent_count = random_state.entropy_count;
- put_user(ent_count, p++);
- retval = verify_area(VERIFY_WRITE, (void *) p, sizeof(int));
- if (retval)
- return(retval);
- get_user(size, p);
- put_user(POOLWORDS, p++);
+ if (put_user(ent_count, p++))
+ return -EFAULT;
+
+ if (get_user(size, p))
+ return -EFAULT;
+ if (put_user(POOLWORDS, p++))
+ return -EFAULT;
if (size < 0)
return -EINVAL;
if (size > POOLWORDS)
@@ -1467,16 +1461,12 @@
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
p = (int *) arg;
- retval = verify_area(VERIFY_READ, (void *) p, 2*sizeof(int));
- if (retval)
- return(retval);
- get_user(ent_count, p++);
+ if (get_user(ent_count, p++))
+ return -EFAULT;
if (ent_count < 0)
return -EINVAL;
- get_user(size, p++);
- retval = verify_area(VERIFY_READ, (void *) p, size);
- if (retval)
- return retval;
+ if (get_user(size, p++))
+ return -EFAULT;
retval = random_write(file, (const char *) p,
size, &file->f_pos);
if (retval < 0)
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov