[PATCH kvmtool 3/3] virtio/rng: Fix build warning from min()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 virtio/rng.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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;
-- 
2.40.1




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux