public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [bug report] KVM: VMX: Use GPA legality helpers to replace open coded equivalents
@ 2025-03-07  9:32 Dan Carpenter
  2025-03-07 15:02 ` Sean Christopherson
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2025-03-07  9:32 UTC (permalink / raw)
  To: Sean Christopherson; +Cc: kvm

Hello Sean Christopherson,

Commit 636e8b733491 ("KVM: VMX: Use GPA legality helpers to replace
open coded equivalents") from Feb 3, 2021 (linux-next), leads to the
following Smatch static checker warning:

	arch/x86/kvm/vmx/nested.c:834 nested_vmx_check_msr_switch()
	warn: potential user controlled sizeof overflow 'addr + count * 16' '0-u64max + 16-68719476720'

arch/x86/kvm/vmx/nested.c
    827 static int nested_vmx_check_msr_switch(struct kvm_vcpu *vcpu,
    828                                        u32 count, u64 addr)
    829 {
    830         if (count == 0)
    831                 return 0;
    832 
    833         if (!kvm_vcpu_is_legal_aligned_gpa(vcpu, addr, 16) ||
--> 834             !kvm_vcpu_is_legal_gpa(vcpu, (addr + count * sizeof(struct vmx_msr_entry) - 1)))
                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Do we support kvm on 32bit systems?

    835                 return -EINVAL;
    836 
    837         return 0;
    838 }

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-03-07 15:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-07  9:32 [bug report] KVM: VMX: Use GPA legality helpers to replace open coded equivalents Dan Carpenter
2025-03-07 15:02 ` Sean Christopherson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox