diff options
| author | John-Mark Gurney <jmg@FreeBSD.org> | 2015-02-17 17:37:00 +0000 |
|---|---|---|
| committer | John-Mark Gurney <jmg@FreeBSD.org> | 2015-02-17 17:37:00 +0000 |
| commit | 601e8bcdf43210eb388138a966cca8a32596bba3 (patch) | |
| tree | 643eba92e81c7da9b107d1cbd573ea15e3eecd59 /sys/dev/random/randomdev.c | |
| parent | d2f783303b3f16a7b930190f8cd417df16312d94 (diff) | |
Notes
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 c61bed790c35..9d41aedfb4bf 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; } |
