Commit 4c9f7372fcf158d8a5d85ce9ce2988c27be63baf

Authored by aliguori
1 parent 56cd2b96

Correctly initialize msr list in KVM

I believe this was spotted by Gerd Hoffman but I can't find his patch 
now.  This will cause very subtle corruption on the heap because we 
don't allocate the appropriately sized buffer.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6017 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 1 additions and 1 deletions
target-i386/kvm.c
... ... @@ -90,11 +90,11 @@ static int kvm_has_msr_star(CPUState *env)
90 90  
91 91 /* Obtain MSR list from KVM. These are the MSRs that we must
92 92 * save/restore */
  93 + msr_list.nmsrs = 0;
93 94 ret = kvm_ioctl(env->kvm_state, KVM_GET_MSR_INDEX_LIST, &msr_list);
94 95 if (ret < 0)
95 96 return 0;
96 97  
97   - msr_list.nmsrs = 0;
98 98 kvm_msr_list = qemu_mallocz(sizeof(msr_list) +
99 99 msr_list.nmsrs * sizeof(msr_list.indices[0]));
100 100 if (kvm_msr_list == NULL)
... ...