From: Carlo Marcelo Arenas Belon <carenas-kLeDWSohozoJb6fo7hG9ng@public.gmane.org>
To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: [PATCH] [RESEND] libkvm: NULL pointer dereference in kvm_destroy_phys_mem as used in kvm-56
Date: Tue, 18 Dec 2007 02:37:53 -0600 [thread overview]
Message-ID: <20071218083753.GA15987@tapir> (raw)
In-Reply-To: <20071214065827.GA12031@tapir>
The following patch eliminates the uninitialized mem pointer, using
instead the corresponding entry from the slots array to fix :
libkvm.c:580: warning: 'mem' is used uninitialized in this function
Also changes the formatting type for phys_addr to long to prevent :
libkvm.c:581: warning: format '%llx' expects type 'long long unsigned int'
, but argument 5 has type 'long unsigned int'
Signed-off-by: Carlo Marcelo Arenas Belon <carenas-kLeDWSohozoJb6fo7hG9ng@public.gmane.org>
---
libkvm/libkvm.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
index 93d7b6b..fc2e265 100644
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -567,7 +567,6 @@ void kvm_destroy_phys_mem(kvm_context_t kvm, unsigned long phys_start,
unsigned long len)
{
int slot;
- struct kvm_memory_region *mem;
slot = get_slot(phys_start);
@@ -578,9 +577,9 @@ void kvm_destroy_phys_mem(kvm_context_t kvm, unsigned long phys_start,
}
if (phys_start != slots[slot].phys_addr) {
fprintf(stderr,
- "WARNING: %s: phys_start is 0x%lx expecting 0x%llx\n",
- __FUNCTION__, phys_start, mem->guest_phys_addr);
- phys_start = mem->guest_phys_addr;
+ "WARNING: %s: phys_start is 0x%lx expecting 0x%lx\n",
+ __FUNCTION__, phys_start, slots[slot].phys_addr);
+ phys_start = slots[slot].phys_addr;
}
kvm_create_phys_mem(kvm, phys_start, 0, 0, 0);
}
--
1.5.2.5
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
next prev parent reply other threads:[~2007-12-18 8:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-14 6:58 [PATCH] libkvm: null pointer dereference in kvm_destroy_phys_mem Carlo Marcelo Arenas Belon
2007-12-18 8:37 ` Carlo Marcelo Arenas Belon [this message]
2007-12-18 16:20 ` [PATCH] [RESEND] libkvm: NULL pointer dereference in kvm_destroy_phys_mem as used in kvm-56 Avi Kivity
[not found] ` <4767F333.5010907-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-12-19 15:30 ` Carlo Marcelo Arenas Belon
2007-12-19 15:29 ` 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=20071218083753.GA15987@tapir \
--to=carenas-kledwsohozojb6fo7hg9ng@public.gmane.org \
--cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox