lkml.org 
[lkml]   [2020]   [Jan]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v3 04/21] KVM: Add build-time error check on kvm_run size
    Date
    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>
    ---
    virt/kvm/kvm_main.c | 1 +
    1 file changed, 1 insertion(+)

    diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
    index 24c9cf4c8a52..70b78ccaf3b5 100644
    --- a/virt/kvm/kvm_main.c
    +++ b/virt/kvm/kvm_main.c
    @@ -338,6 +338,7 @@ int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id)
    vcpu->pre_pcpu = -1;
    INIT_LIST_HEAD(&vcpu->blocked_vcpu_list);

    + BUILD_BUG_ON(sizeof(struct kvm_run) > PAGE_SIZE);
    page = alloc_page(GFP_KERNEL | __GFP_ZERO);
    if (!page) {
    r = -ENOMEM;
    --
    2.24.1
    \
     
     \ /
      Last update: 2020-01-09 15:58    [W:4.124 / U:0.140 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site