All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Avi Kivity <avi@qumranet.com>
Cc: kvm-devel <kvm-devel@lists.sourceforge.net>,
	Marcelo Tosatti <mtosatti@redhat.com>
Subject: Re: libkvm: initialize no_pit_creation
Date: Mon, 28 Apr 2008 19:58:59 +0200	[thread overview]
Message-ID: <48161063.7040002@siemens.com> (raw)
In-Reply-To: <48147690.1040105@qumranet.com>

Avi Kivity wrote:
> Marcelo Tosatti wrote:
>> Valgrind caught this:
>>
>> ==11754== Conditional jump or move depends on uninitialised value(s)
>> ==11754==    at 0x50C9BC: kvm_create_pit (libkvm-x86.c:153)
>> ==11754==    by 0x50CA7F: kvm_arch_create (libkvm-x86.c:178)
>> ==11754==    by 0x50AB31: kvm_create (libkvm.c:383)
>> ==11754==    by 0x4EE691: kvm_qemu_create_context (qemu-kvm.c:616)
>> ==11754==    by 0x412031: main (vl.c:9653)
>>
>>   
> 
> Applied, thanks.  Isn't valgrind great?
> 

Yeah, it is. Reminds me of another warning I recently came across
(offsets may vary due to other patches:

==5801== 1 errors in context 1 of 2:
==5801== Conditional jump or move depends on uninitialised value(s)
==5801==    at 0x53F4AE: kvm_register_userspace_phys_mem (libkvm.c:552)
==5801==    by 0x521ACA: kvm_cpu_register_physical_memory (qemu-kvm.c:654)
==5801==    by 0x45FC82: pc_init1 (pc.c:809)
==5801==    by 0x461313: pc_init_pci (pc.c:1149)
==5801==    by 0x43081B: main (vl.c:9845)

This silences valgrind and may even be correct (if I got the code path
right):

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>

--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -328,9 +328,10 @@ static int kvm_create_default_phys_mem(k
 
 #ifdef KVM_CAP_USER_MEMORY
 	r = ioctl(kvm->fd, KVM_CHECK_EXTENSION, KVM_CAP_USER_MEMORY);
-	if (r > 0)
+	if (r > 0) {
+		kvm->physical_memory = NULL;
 		return 0;
-	else
+	} else
 #endif
 		r = kvm_alloc_kernel_memory(kvm, memory, vm_mem);
 	if (r < 0)

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

  reply	other threads:[~2008-04-28 17:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-26  0:53 libkvm: initialize no_pit_creation Marcelo Tosatti
2008-04-27 12:50 ` Avi Kivity
2008-04-28 17:58   ` Jan Kiszka [this message]
2008-05-02 11:22     ` Avi Kivity

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=48161063.7040002@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=avi@qumranet.com \
    --cc=kvm-devel@lists.sourceforge.net \
    --cc=mtosatti@redhat.com \
    /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.