>>> On 10.09.18 at 16:26, <aisa...@bitdefender.com> wrote: > @@ -148,14 +146,17 @@ int hvm_save_one(struct domain *d, unsigned int > typecode, unsigned int instance, > !hvm_sr_handlers[typecode].save ) > return -EINVAL; > > + if ( instance >= d->max_vcpus && > + hvm_sr_handlers[typecode].kind == HVMSR_PER_VCPU ) > + return -ENOENT; > + v = d->vcpu[hvm_sr_handlers[typecode].kind == HVMSR_PER_VCPU ? > + instance : 0];
I think this would be easier to read (less redundancy) as if ( hvm_sr_handlers[typecode].kind != HVMSR_PER_VCPU ) v = d->vcpu[0]; else if ( instance >= d->max_vcpus || !d->vcpu[instance] ) return -ENOENT; else v = d->vcpu[instance]; When I had suggested putting the conditional operator inside the square brackets there was too little context provided. Should I end up committing this, I think I'll edit the patch accordingly (the NULL check needs adding anyway). With at least the NULL check in place Reviewed-by: Jan Beulich <jbeul...@suse.com> Jan _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel