diff options
author | dim <dim@FreeBSD.org> | 2015-02-17 19:53:41 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2015-02-17 19:53:41 +0000 |
commit | d27bd4650ea928097e260433cb5c69be0dda440f (patch) | |
tree | 9b840acec4a7a5a64b3092e4f4cbb8197e629360 /sys/dev/random/randomdev.c | |
parent | 9377b5ad0feb5dd018ed6cfc6378ac19c1252dfe (diff) | |
parent | 68a4902d98c88ebff2f1dfd8bee849d62233ba60 (diff) | |
download | FreeBSD-src-d27bd4650ea928097e260433cb5c69be0dda440f.zip FreeBSD-src-d27bd4650ea928097e260433cb5c69be0dda440f.tar.gz |
Merge ^/head r278756 through r278915.
Diffstat (limited to 'sys/dev/random/randomdev.c')
-rw-r--r-- | sys/dev/random/randomdev.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/dev/random/randomdev.c b/sys/dev/random/randomdev.c index c61bed7..9d41aed 100644 --- a/sys/dev/random/randomdev.c +++ b/sys/dev/random/randomdev.c @@ -214,11 +214,11 @@ random_harvest(const void *entropy, u_int count, u_int bits, enum random_entropy */ /* Hold the address of the routine which is actually called */ -static u_int (*read_func)(uint8_t *, u_int) = dummy_random_read_phony; +static void (*read_func)(uint8_t *, u_int) = dummy_random_read_phony; /* Initialise the reader when/if it is loaded */ void -randomdev_init_reader(u_int (*reader)(uint8_t *, u_int)) +randomdev_init_reader(void (*reader)(uint8_t *, u_int)) { read_func = reader; @@ -240,5 +240,10 @@ int read_random(void *buf, int count) { - return ((int)(*read_func)(buf, (u_int)count)); + if (count < 0) + return 0; + + read_func(buf, count); + + return count; } |