Commit 43ae4860 authored by Matt Mackall's avatar Matt Mackall Committed by Linus Torvalds

random: use unlocked_ioctl

No locking actually needed.
Signed-off-by: default avatarMatt Mackall <mpm@selenic.com>
Cc: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 88c730da
...@@ -1062,8 +1062,7 @@ static ssize_t random_write(struct file *file, const char __user *buffer, ...@@ -1062,8 +1062,7 @@ static ssize_t random_write(struct file *file, const char __user *buffer,
return (ssize_t)count; return (ssize_t)count;
} }
static int random_ioctl(struct inode *inode, struct file *file, static long random_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
unsigned int cmd, unsigned long arg)
{ {
int size, ent_count; int size, ent_count;
int __user *p = (int __user *)arg; int __user *p = (int __user *)arg;
...@@ -1071,8 +1070,8 @@ static int random_ioctl(struct inode *inode, struct file *file, ...@@ -1071,8 +1070,8 @@ static int random_ioctl(struct inode *inode, struct file *file,
switch (cmd) { switch (cmd) {
case RNDGETENTCNT: case RNDGETENTCNT:
ent_count = input_pool.entropy_count; /* inherently racy, no point locking */
if (put_user(ent_count, p)) if (put_user(input_pool.entropy_count, p))
return -EFAULT; return -EFAULT;
return 0; return 0;
case RNDADDTOENTCNT: case RNDADDTOENTCNT:
...@@ -1115,13 +1114,13 @@ const struct file_operations random_fops = { ...@@ -1115,13 +1114,13 @@ const struct file_operations random_fops = {
.read = random_read, .read = random_read,
.write = random_write, .write = random_write,
.poll = random_poll, .poll = random_poll,
.ioctl = random_ioctl, .unlocked_ioctl = random_ioctl,
}; };
const struct file_operations urandom_fops = { const struct file_operations urandom_fops = {
.read = urandom_read, .read = urandom_read,
.write = random_write, .write = random_write,
.ioctl = random_ioctl, .unlocked_ioctl = random_ioctl,
}; };
/*************************************************************** /***************************************************************
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment