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@us.ibm.com> diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index 9de85ae..2f77bfe 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c @@ -82,7 +82,7 @@ static void tell_host(struct virtio_balloon *vb, struct virtqueue *vq) wait_for_completion(&vb->acked); } -static void fill_balloon(struct virtio_balloon *vb, unsigned int num) +static void fill_balloon(struct virtio_balloon *vb, unsigned long num) { /* We can only do one array worth at a time. */ num = min(num, ARRAY_SIZE(vb->pfns)); @@ -92,7 +92,7 @@ static void fill_balloon(struct virtio_balloon *vb, unsigned int num) if (!page) { if (printk_ratelimit()) dev_printk(KERN_INFO, &vb->vdev->dev, - "Out of puff! Can't get %u pages\n", + "Out of puff! Can't get %lu pages\n", num); /* Sleep for at least 1/5 of a second before retry. */ msleep(200); @@ -121,7 +121,7 @@ static void release_pages_by_pfn(const u32 pfns[], unsigned int num) } } -static void leak_balloon(struct virtio_balloon *vb, unsigned int num) +static void leak_balloon(struct virtio_balloon *vb, unsigned long num) { struct page *page;
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@us.ibm.com> >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 -------------- next part -------------- A non-text attachment was scrubbed... Name: virtio:balloon_min.diff Type: text/x-patch Size: 1239 bytes Desc: not available Url : http://lists.linux-foundation.org/pipermail/virtualization/attachments/20080124/e1a98b13/balloon_min.bin
On Friday 25 January 2008 07:03:18 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.Creates warning on 32-bit. How about this? == On x86_64, min was throwing a warning. size_t is correct for 32 and 64. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c @@ -82,7 +82,7 @@ static void tell_host(struct virtio_ball wait_for_completion(&vb->acked); } -static void fill_balloon(struct virtio_balloon *vb, unsigned int num) +static void fill_balloon(struct virtio_balloon *vb, size_t num) { /* We can only do one array worth at a time. */ num = min(num, ARRAY_SIZE(vb->pfns)); @@ -92,7 +92,7 @@ static void fill_balloon(struct virtio_b if (!page) { if (printk_ratelimit()) dev_printk(KERN_INFO, &vb->vdev->dev, - "Out of puff! Can't get %u pages\n", + "Out of puff! Can't get %zu pages\n", num); /* Sleep for at least 1/5 of a second before retry. */ msleep(200); @@ -121,7 +121,7 @@ static void release_pages_by_pfn(const u } } -static void leak_balloon(struct virtio_balloon *vb, unsigned int num) +static void leak_balloon(struct virtio_balloon *vb, size_t num) { struct page *page;
Apparently Analagous Threads
- [PATCH] Fix compile warnings in virtio_balloon
- [PATCH] virtio_balloon: Convert "vballon" kthread into a workqueue
- [PATCH] virtio_balloon: Convert "vballon" kthread into a workqueue
- [patch] virtio_balloon: unlock on error in fill_balloon()
- [patch] virtio_balloon: unlock on error in fill_balloon()