}
static ssize_t
-random_read(struct file * file, char * buf, size_t nbytes, loff_t *ppos)
+random_read(struct file * file, char __user * buf, size_t nbytes, loff_t *ppos)
{
DECLARE_WAITQUEUE(wait, current);
ssize_t n, retval = 0, count = 0;
}
static ssize_t
-urandom_read(struct file * file, char * buf,
+urandom_read(struct file * file, char __user * buf,
size_t nbytes, loff_t *ppos)
{
return extract_entropy(sec_random_state, buf, nbytes,
}
static ssize_t
-random_write(struct file * file, const char * buffer,
+random_write(struct file * file, const char __user * buffer,
size_t count, loff_t *ppos)
{
int ret = 0;
size_t bytes;
__u32 buf[16];
- const char *p = buffer;
+ const char __user *p = buffer;
size_t c = count;
while (c > 0) {
random_ioctl(struct inode * inode, struct file * file,
unsigned int cmd, unsigned long arg)
{
- int *p, *tmp, size, ent_count;
+ int *tmp, size, ent_count;
+ int __user *p = (int __user *)arg;
int retval;
unsigned long flags;
switch (cmd) {
case RNDGETENTCNT:
ent_count = random_state->entropy_count;
- if (put_user(ent_count, (int *) arg))
+ if (put_user(ent_count, p))
return -EFAULT;
return 0;
case RNDADDTOENTCNT:
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
- if (get_user(ent_count, (int *) arg))
+ if (get_user(ent_count, p))
return -EFAULT;
credit_entropy_store(random_state, ent_count);
/*
case RNDGETPOOL:
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
- p = (int *) arg;
if (get_user(size, p) ||
put_user(random_state->poolinfo.poolwords, p++))
return -EFAULT;
case RNDADDENTROPY:
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
- p = (int *) arg;
if (get_user(ent_count, p++))
return -EFAULT;
if (ent_count < 0)
return -EINVAL;
if (get_user(size, p++))
return -EFAULT;
- retval = random_write(file, (const char *) p,
+ retval = random_write(file, (const char __user *) p,
size, &file->f_pos);
if (retval < 0)
return retval;
}
static int proc_do_poolsize(ctl_table *table, int write, struct file *filp,
- void *buffer, size_t *lenp)
+ void __user *buffer, size_t *lenp)
{
int ret;
return change_poolsize(sysctl_poolsize);
}
-static int poolsize_strategy(ctl_table *table, int *name, int nlen,
- void *oldval, size_t *oldlenp,
- void *newval, size_t newlen, void **context)
+static int poolsize_strategy(ctl_table *table, int __user *name, int nlen,
+ void __user *oldval, size_t __user *oldlenp,
+ void __user *newval, size_t newlen, void **context)
{
int len;
* sysctl system call, it is returned as 16 bytes of binary data.
*/
static int proc_do_uuid(ctl_table *table, int write, struct file *filp,
- void *buffer, size_t *lenp)
+ void __user *buffer, size_t *lenp)
{
ctl_table fake_table;
unsigned char buf[64], tmp_uuid[16], *uuid;
return proc_dostring(&fake_table, write, filp, buffer, lenp);
}
-static int uuid_strategy(ctl_table *table, int *name, int nlen,
- void *oldval, size_t *oldlenp,
- void *newval, size_t newlen, void **context)
+static int uuid_strategy(ctl_table *table, int __user *name, int nlen,
+ void __user *oldval, size_t __user *oldlenp,
+ void __user *newval, size_t newlen, void **context)
{
unsigned char tmp_uuid[16], *uuid;
unsigned int len;