[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] xen/sched: Introduce domain_vcpu() helper

>>> On 23.01.19 at 15:59, <andrew.cooper3@xxxxxxxxxx> wrote:
> +static inline struct vcpu *domain_vcpu(const struct domain *d,
> +                                       unsigned int vcpu_id)
> +{
> +    unsigned int idx = array_index_nospec(vcpu_id, d->max_vcpus);
> +
> +    return idx >= d->max_vcpus ? NULL : d->vcpu[idx];
> +}

For an out of bounds incoming vcpu_id, isn't it the case that
idx then would be zero? In which case you'd return d->vcpu[0]
instead of NULL?


Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.