lkml.org 
[lkml]   [2016]   [Jun]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v1 03/11] KVM: x86: dynamic kvm_apic_map
> -
> - new = kzalloc(sizeof(struct kvm_apic_map), GFP_KERNEL);
> + u32 size, max_id = 255;
>
> mutex_lock(&kvm->arch.apic_map_lock);
>
> + kvm_for_each_vcpu(i, vcpu, kvm)
> + if (kvm_apic_present(vcpu))
> + max_id = max(max_id, kvm_apic_id(vcpu->arch.apic));
> +
> + /* kvm_apic_map_get_logical_dest() expects multiples of 16 */
> + size = round_up(max_id + 1, 16);

Now that you're using the full range of apic_id values, could this
calculation overflow? Perhaps max_id could be u64?

> + new = kzalloc(sizeof(struct kvm_apic_map) +
> + sizeof(struct kvm_lapic) * size, GFP_KERNEL);
> +
> if (!new)
> goto out;
>

\
 
 \ /
  Last update: 2016-07-01 01:01    [W:0.204 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site