virtio/rng: Fix build warning from min()
On a 32-bit build GCC complains about the min() parameters:
include/linux/kernel.h:36:24: error: comparison of distinct pointer types lacks a cast [-Werror]
36 | (void) (&_min1 == &_min2); \
| ^~
virtio/rng.c:78:34: note: in expansion of macro 'min'
78 | iov[0].iov_len = min(iov[0].iov_len, 256UL);
| ^~~
Use min_t() instead
Fixes: bc23b9d9b152 ("virtio/rng: return at least one byte of entropy")
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Link: https://lore.kernel.org/r/20230606143733.994679-4-jean-philippe@linaro.org
Signed-off-by: Will Deacon <will@kernel.org>
diff --git a/virtio/rng.c b/virtio/rng.c
index 77a3a11..6b36655 100644
--- a/virtio/rng.c
+++ b/virtio/rng.c
@@ -75,7 +75,7 @@
* just retry here, with the requested size clamped to that
* maximum, in case we were interrupted by a signal.
*/
- iov[0].iov_len = min(iov[0].iov_len, 256UL);
+ iov[0].iov_len = min_t(size_t, iov[0].iov_len, 256UL);
len = readv(rdev->fd, iov, 1);
if (len < 1)
return false;