Re: [PATCH] Fix compile warnings in virtio_balloon

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

 



Anthony Liguori wrote:
On x86_64, min was throwing a warning.  ARRAY_SIZE is unsigned long so let's
switch to using that for num.

Signed-off-by: Anthony Liguori <aliguori@xxxxxxxxxx>

Okay, that just changed the warning to occur on i386. Please use the attached patch instead which just casts within the min macro.

Regards,

Anthony Liguori

Subject: [PATCH] Fix compile warnings in virtio_balloon
Cc: Rusty Russell <rusty@xxxxxxxxxxxxxxx>

On x86_64, min was throwing a warning. Let's explicitly cast to avoid the
warning.

Signed-off-by: Anthony Liguori <aliguori@xxxxxxxxxx>

diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index 9de85ae..cb7f1df 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -85,7 +85,7 @@ static void tell_host(struct virtio_balloon *vb, struct virtqueue *vq)
 static void fill_balloon(struct virtio_balloon *vb, unsigned int num)
 {
 	/* We can only do one array worth at a time. */
-	num = min(num, ARRAY_SIZE(vb->pfns));
+	num = min(num, (unsigned int)ARRAY_SIZE(vb->pfns));
 
 	for (vb->num_pfns = 0; vb->num_pfns < num; vb->num_pfns++) {
 		struct page *page = alloc_page(GFP_HIGHUSER | __GFP_NORETRY);
@@ -126,7 +126,7 @@ static void leak_balloon(struct virtio_balloon *vb, unsigned int num)
 	struct page *page;
 
 	/* We can only do one array worth at a time. */
-	num = min(num, ARRAY_SIZE(vb->pfns));
+	num = min(num, (unsigned int)ARRAY_SIZE(vb->pfns));
 
 	for (vb->num_pfns = 0; vb->num_pfns < num; vb->num_pfns++) {
 		page = list_first_entry(&vb->pages, struct page, lru);
_______________________________________________
Virtualization mailing list
Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linux-foundation.org/mailman/listinfo/virtualization

[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux