[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH v4 8/8] kvm: Potential NULL pointer dereference in k
From: |
Liam Merwick |
Subject: |
[Qemu-block] [PATCH v4 8/8] kvm: Potential NULL pointer dereference in kvm_arch_init_vcpu() |
Date: |
Fri, 19 Oct 2018 21:39:06 +0100 |
In kvm_arch_init_vcpu() a call to cpuid_find_entry() can return
NULL so the pointer returned should be checked before dereferencing it.
Signed-off-by: Liam Merwick <address@hidden>
---
target/i386/kvm.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index dc4047b02fc5..eb19c87a9d25 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -1177,7 +1177,9 @@ int kvm_arch_init_vcpu(CPUState *cs)
c->ecx = c->edx = 0;
c = cpuid_find_entry(&cpuid_data.cpuid, kvm_base, 0);
- c->eax = MAX(c->eax, KVM_CPUID_SIGNATURE | 0x10);
+ if (c) {
+ c->eax = MAX(c->eax, KVM_CPUID_SIGNATURE | 0x10);
+ }
}
cpuid_data.cpuid.nent = cpuid_i;
--
1.8.3.1
- [Qemu-block] [PATCH v4 0/8] off-by-one and NULL pointer accesses detected by static analysis, Liam Merwick, 2018/10/19
- [Qemu-block] [PATCH v4 3/8] block: Null pointer dereference in blk_root_get_parent_desc(), Liam Merwick, 2018/10/19
- [Qemu-block] [PATCH v4 4/8] qemu-img: assert block_job_get() does not return NULL in img_commit(), Liam Merwick, 2018/10/19
- [Qemu-block] [PATCH v4 2/8] job: Fix off-by-one assert checks for JobSTT and JobVerbTable, Liam Merwick, 2018/10/19
- [Qemu-block] [PATCH v4 1/8] configure: Provide option to explicitly disable AVX2, Liam Merwick, 2018/10/19
- [Qemu-block] [PATCH v4 6/8] block: dump_qlist() may dereference a Null pointer, Liam Merwick, 2018/10/19
- [Qemu-block] [PATCH v4 7/8] qcow2: Read outside array bounds in qcow2_pre_write_overlap_check(), Liam Merwick, 2018/10/19
- [Qemu-block] [PATCH v4 5/8] block: Fix potential Null pointer dereferences in vvfat.c, Liam Merwick, 2018/10/19
- [Qemu-block] [PATCH v4 8/8] kvm: Potential NULL pointer dereference in kvm_arch_init_vcpu(),
Liam Merwick <=