Skip to contentSkip to conversation

KVM: SVM: hyper-v: Enlightened MSR-Bitmap support

bug report Dan Carpenter 1 participant 1 message Jun 25, 2021 KVM

lore
Share & tools
lore
#0 lore raw

Hello Vineeth Pillai,

This is a semi-automatic email about new static checker warnings.

The patch c4327f15dfc7: "KVM: SVM: hyper-v: Enlightened MSR-Bitmap support" from Jun 3, 2021, leads to the following Smatch complaint:

arch/x86/kvm/svm/svm_onhyperv.h:92 svm_hv_vmcb_dirty_nested_enlightenments()
warn: variable dereferenced before check 'vmcb' (see line 84)

arch/x86/kvm/svm/svm_onhyperv.h

    83		struct hv_enlightenments *hve =
    84			(struct hv_enlightenments *)vmcb->control.reserved_sw;
                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^

Dereferenced

    85	
    86		/*
    87		 * vmcb can be NULL if called during early vcpu init.
                   ^^^^^^^^^^^^^^^^

Probably shouldn't be Dereferenced

    88		 * And its okay not to mark vmcb dirty during vcpu init
    89		 * as we mark it dirty unconditionally towards end of vcpu
    90		 * init phase.
    91		 */
    92		if (vmcb && vmcb_is_clean(vmcb, VMCB_HV_NESTED_ENLIGHTENMENTS) &&
                    ^^^^

    93		    hve->hv_enlightenments_control.msr_bitmap)
    94			vmcb_mark_dirty(vmcb, VMCB_HV_NESTED_ENLIGHTENMENTS);

regards,
dan carpenter