All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: KVM devel mailing list <kvm@vger.kernel.org>
Subject: [PATCH] kvm tools: Fix type mismatches on GCC 4.4 on 32-bit systems
Date: Fri, 13 May 2011 10:19:09 +0200	[thread overview]
Message-ID: <20110513081909.GA14603@elte.hu> (raw)


FYI, the tools/kvm build still fails on 32-bit:

 cc1: warnings being treated as errors
 qcow.c: In function ‘qcow1_write_sector’:
 qcow.c:307: error: comparison between signed and unsigned integer expressions
 make: *** [qcow.o] Error 1
 make: *** Waiting for unfinished jobs....

using:

 gcc version 4.4.4 20100630 (Red Hat 4.4.4-10) (GCC)

The patch below addresses them but i haven't tested it beyond checking that it 
builds.

The double cast of userspace_addr is doubly sad - it highlights our 32-bitness 
problems which are visible in the guest_pfn_to_host() function as well.

Thanks,

	Ingo

---

Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/tools/kvm/kvm.c b/tools/kvm/kvm.c
index c69fcc4..e3f9d02 100644
--- a/tools/kvm/kvm.c
+++ b/tools/kvm/kvm.c
@@ -162,7 +162,7 @@ static void kvm_register_mem_slot(struct kvm *kvm, u32 slot, u64 guest_phys, u64
 		.slot			= slot,
 		.guest_phys_addr	= guest_phys,
 		.memory_size		= size,
-		.userspace_addr		= (u64)userspace_addr,
+		.userspace_addr		= (u64)(long)userspace_addr,
 	};
 
 	ret = ioctl(kvm->vm_fd, KVM_SET_USER_MEMORY_REGION, &mem);
diff --git a/tools/kvm/qcow.c b/tools/kvm/qcow.c
index 8e1b70d..bb2345c 100644
--- a/tools/kvm/qcow.c
+++ b/tools/kvm/qcow.c
@@ -295,7 +295,7 @@ static int qcow1_write_sector(struct disk_image *disk, u64 sector, void *src, u3
 {
 	struct qcow *q = disk->priv;
 	struct qcow_header *header = q->header;
-	ssize_t nr_written;
+	u32 nr_written;
 	char *buf;
 	u64 offset;
 	ssize_t nr;

             reply	other threads:[~2011-05-13  8:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-13  8:19 Ingo Molnar [this message]
2011-05-13  8:27 ` [PATCH] kvm tools: Fix type mismatches on GCC 4.4 on 32-bit systems Pekka Enberg
2011-05-13  8:37   ` Ingo Molnar
2011-05-13  9:11 ` Sasha Levin
2011-05-13 10:05   ` Ingo Molnar

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=20110513081909.GA14603@elte.hu \
    --to=mingo@elte.hu \
    --cc=kvm@vger.kernel.org \
    --cc=penberg@cs.helsinki.fi \
    /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.