All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: virtualization@lists.linux-foundation.org
Subject: Re: [PATCH] Fix compile warnings in virtio_balloon
Date: Thu, 24 Jan 2008 16:14:30 -0600	[thread overview]
Message-ID: <47990DC6.6020203@us.ibm.com> (raw)
In-Reply-To: <12012049981852-git-send-email-aliguori@us.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 358 bytes --]

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


[-- Attachment #2: virtio:balloon_min.diff --]
[-- Type: text/x-patch, Size: 1239 bytes --]

Subject: [PATCH] Fix compile warnings in virtio_balloon
Cc: Rusty Russell <rusty@rustcorp.com.au>

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

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..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);

[-- Attachment #3: Type: text/plain, Size: 184 bytes --]

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/virtualization

  reply	other threads:[~2008-01-24 22:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-24 20:03 [PATCH] Fix compile warnings in virtio_balloon Anthony Liguori
2008-01-24 22:14 ` Anthony Liguori [this message]
2008-01-24 23:09 ` Rusty Russell
2008-01-25 15:29   ` Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47990DC6.6020203@us.ibm.com \
    --to=aliguori@us.ibm.com \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.