Skip to content

Commit

Permalink
KVM: SVM: Switch to bitmap_zalloc()
Browse files Browse the repository at this point in the history
Switch to bitmap_zalloc() to show clearly what we are allocating.
Besides that it returns pointer of bitmap type instead of opaque void *.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
Andy Shevchenko authored and Paolo Bonzini committed Sep 19, 2018
1 parent 9a98458 commit a101c9d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions arch/x86/kvm/svm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1226,8 +1226,7 @@ static __init int sev_hardware_setup(void)
min_sev_asid = cpuid_edx(0x8000001F);

/* Initialize SEV ASID bitmap */
sev_asid_bitmap = kcalloc(BITS_TO_LONGS(max_sev_asid),
sizeof(unsigned long), GFP_KERNEL);
sev_asid_bitmap = bitmap_zalloc(max_sev_asid, GFP_KERNEL);
if (!sev_asid_bitmap)
return 1;

Expand Down Expand Up @@ -1405,7 +1404,7 @@ static __exit void svm_hardware_unsetup(void)
int cpu;

if (svm_sev_enabled())
kfree(sev_asid_bitmap);
bitmap_free(sev_asid_bitmap);

for_each_possible_cpu(cpu)
svm_cpu_uninit(cpu);
Expand Down

0 comments on commit a101c9d

Please sign in to comment.