aboutsummaryrefslogtreecommitdiffstats
path: root/include/os/freebsd/spl/sys/random.h
diff options
context:
space:
mode:
authorMartin Matuška <[email protected]>2021-06-25 19:28:51 +0200
committerTony Hutter <[email protected]>2021-11-02 13:35:47 -0700
commitb7ecb4ff0d89420087cc67118069471a96b9a97c (patch)
tree4bda729255b20a154239bc27f0adde6e5eed995e /include/os/freebsd/spl/sys/random.h
parentaf9aa4a2166e42e0cceeb9911aacb46e903b6892 (diff)
FreeBSD: fix compilation of FreeBSD world after 29274c9f6
prng32_bounded() is available to kernel only on FreeBSD 13+. Call inline random_get_pseudo_bytes() with correct pointer type. To be consistent, apply to Linux as well. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Signed-off-by: Martin Matuska <[email protected]> Closes #12282
Diffstat (limited to 'include/os/freebsd/spl/sys/random.h')
-rw-r--r--include/os/freebsd/spl/sys/random.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/os/freebsd/spl/sys/random.h b/include/os/freebsd/spl/sys/random.h
index 746275e53..7583166e7 100644
--- a/include/os/freebsd/spl/sys/random.h
+++ b/include/os/freebsd/spl/sys/random.h
@@ -51,7 +51,7 @@ random_get_pseudo_bytes(uint8_t *p, size_t s)
static inline uint32_t
random_in_range(uint32_t range)
{
-#if __FreeBSD_version >= 1300108
+#if defined(_KERNEL) && __FreeBSD_version >= 1300108
return (prng32_bounded(range));
#else
uint32_t r;
@@ -61,7 +61,7 @@ random_in_range(uint32_t range)
if (range == 1)
return (0);
- (void) random_get_pseudo_bytes((void *)&r, sizeof (r));
+ (void) random_get_pseudo_bytes((uint8_t *)&r, sizeof (r));
return (r % range);
#endif