diff options
author | Peter Xu <peterx@redhat.com> | 2020-01-09 09:57:12 -0500 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2020-01-27 19:59:52 +0100 |
commit | fcd97ad58f76efcd58808941e4dd2bc6c544b9de (patch) | |
tree | 5dd4881c265a5b2dcc72ce056de2c359cd6822e3 | |
parent | ef82eddc0e3179b4529a67ed102fe4f7efba2e65 (diff) | |
download | linux-fcd97ad58f76efcd58808941e4dd2bc6c544b9de.tar.bz2 |
KVM: Add build-time error check on kvm_run size
It's already going to reach 2400 Bytes (which is over half of page
size on 4K page archs), so maybe it's good to have this build-time
check in case it overflows when adding new fields.
Signed-off-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r-- | virt/kvm/kvm_main.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 929d7fccf7cd..4f3ac8b753b6 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -2710,6 +2710,7 @@ static int kvm_vm_ioctl_create_vcpu(struct kvm *kvm, u32 id) goto vcpu_decrement; } + BUILD_BUG_ON(sizeof(struct kvm_run) > PAGE_SIZE); page = alloc_page(GFP_KERNEL | __GFP_ZERO); if (!page) { r = -ENOMEM; |