From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carlo Marcelo Arenas Belon Subject: [PATCH] libkvm: null pointer dereference in kvm_destroy_phys_mem Date: Fri, 14 Dec 2007 00:58:27 -0600 Message-ID: <20071214065827.GA12031@tapir> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Return-path: Content-Disposition: inline List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org The following patch eliminates the uninitialized mem pointer in kvm_destroy_phys_mem and uses instead the corresponding entry from the slots array in the conditional to fix : libkvm.c:580: warning: 'mem' is used uninitialized in this function Signed-off-by: Carlo Marcelo Arenas Belon --- libkvm/libkvm.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c index 93d7b6b..8f7a34f 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); @@ -579,8 +578,8 @@ 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; + __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