Commit 06fb3199 authored by Dave Jones's avatar Dave Jones

[PATCH] random fixes for random.c

Make things static, and remove hardcoded value
parent dead19d8
...@@ -414,13 +414,13 @@ static void sysctl_init_random(struct entropy_store *random_state); ...@@ -414,13 +414,13 @@ static void sysctl_init_random(struct entropy_store *random_state);
* deal with a variable rotate of x bits. So we use a bit of asm magic. * deal with a variable rotate of x bits. So we use a bit of asm magic.
*/ */
#if (!defined (__i386__)) #if (!defined (__i386__))
extern inline __u32 rotate_left(int i, __u32 word) static inline __u32 rotate_left(int i, __u32 word)
{ {
return (word << i) | (word >> (32 - i)); return (word << i) | (word >> (32 - i));
} }
#else #else
extern inline __u32 rotate_left(int i, __u32 word) static inline __u32 rotate_left(int i, __u32 word)
{ {
__asm__("roll %%cl,%0" __asm__("roll %%cl,%0"
:"=r" (word) :"=r" (word)
...@@ -1643,7 +1643,7 @@ random_ioctl(struct inode * inode, struct file * file, ...@@ -1643,7 +1643,7 @@ random_ioctl(struct inode * inode, struct file * file,
return -EINVAL; return -EINVAL;
if (size > random_state->poolinfo.poolwords) if (size > random_state->poolinfo.poolwords)
size = random_state->poolinfo.poolwords; size = random_state->poolinfo.poolwords;
if (copy_to_user(p, random_state->pool, size * 4)) if (copy_to_user(p, random_state->pool, size * sizeof(__u32)))
return -EFAULT; return -EFAULT;
return 0; return 0;
case RNDADDENTROPY: case RNDADDENTROPY:
......
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