diff options
author | Jean-Philippe Brucker <jean-philippe@linaro.org> | 2023-06-06 15:37:36 +0100 |
---|---|---|
committer | Will Deacon <will@kernel.org> | 2023-06-08 22:38:38 +0100 |
commit | 53114134ce5a1fb2468fdf7d667e42ad0ea98229 (patch) | |
tree | 645fc0e4a38cd16eb3296673ce4dc5a304e28cb3 | |
parent | 426e875213d36a1ff30c5599c2efd3023eadcba6 (diff) | |
download | kvmtool-53114134ce5a1fb2468fdf7d667e42ad0ea98229.tar.gz |
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>
-rw-r--r-- | virtio/rng.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/virtio/rng.c b/virtio/rng.c index 77a3a113..6b366552 100644 --- a/virtio/rng.c +++ b/virtio/rng.c @@ -75,7 +75,7 @@ static bool virtio_rng_do_io_request(struct kvm *kvm, struct rng_dev *rdev, stru * 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; |