diff --git a/include/os/freebsd/spl/sys/random.h b/include/os/freebsd/spl/sys/random.h index 746275e531..7583166e72 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 diff --git a/include/os/linux/spl/sys/random.h b/include/os/linux/spl/sys/random.h index 2c446e1557..52e97e1ce0 100644 --- a/include/os/linux/spl/sys/random.h +++ b/include/os/linux/spl/sys/random.h @@ -46,7 +46,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); } diff --git a/include/sys/zfs_context.h b/include/sys/zfs_context.h index 3cc0afc21e..a6ff943171 100644 --- a/include/sys/zfs_context.h +++ b/include/sys/zfs_context.h @@ -650,7 +650,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); }