KVM: SVM: Switch to bitmap_zalloc()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 30 Aug 2018 11:49:59 +0000 (14:49 +0300)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 19 Sep 2018 22:26:45 +0000 (00:26 +0200)
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>
arch/x86/kvm/svm.c

index 89c4c5aa15f16c71af5404f302a627313a61fd96..c7f1c3fd782d215a4ec4ef69db1120cc8bbd6aec 100644 (file)
@@ -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;
 
@@ -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);