[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] kvm: Potential NULL pointer dereference in kvm_
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH] kvm: Potential NULL pointer dereference in kvm_arch_init_vcpu() |
Date: |
Wed, 30 Jan 2019 16:20:26 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 |
On 30/01/19 15:49, Liam Merwick wrote:
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/target/i386/kvm.c b/target/i386/kvm.c
> index 9af4542fb8a8..89fac4a5576c 100644
> --- a/target/i386/kvm.c
> +++ b/target/i386/kvm.c
> @@ -1308,7 +1308,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
That cannot happen, the line is inside "if (cpu->expose_kvm)" which in
turn has added that CPUID entry to cpuid_data.
Thanks,
Paolo