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

Re: [Xen-devel] [PATCH] xen: hypercall: fix out-of-bounds memcpy



From: Boris Ostrovsky
> Sent: 02 February 2018 23:34
...
> >     switch (cmd) {
> > +   case EVTCHNOP_bind_interdomain:
> > +           len = sizeof(struct evtchn_bind_interdomain);
> > +           break;
> > +   case EVTCHNOP_bind_virq:
> > +           len = sizeof(struct evtchn_bind_virq);
> > +           break;
> > +   case EVTCHNOP_bind_pirq:
> > +           len = sizeof(struct evtchn_bind_pirq);
> > +           break;
> >     case EVTCHNOP_close:
> > +           len = sizeof(struct evtchn_close);
> > +           break;
> >     case EVTCHNOP_send:
> > +           len = sizeof(struct evtchn_send);
> > +           break;
> > +   case EVTCHNOP_alloc_unbound:
> > +           len = sizeof(struct evtchn_alloc_unbound);
> > +           break;
> > +   case EVTCHNOP_bind_ipi:
> > +           len = sizeof(struct evtchn_bind_ipi);
> > +           break;
> > +   case EVTCHNOP_status:
> > +           len = sizeof(struct evtchn_status);
> > +           break;
> >     case EVTCHNOP_bind_vcpu:
> > +           len = sizeof(struct evtchn_bind_vcpu);
> > +           break;
> >     case EVTCHNOP_unmask:
> > -           /* no output */
> > +           len = sizeof(struct evtchn_unmask);
> >             break;

Are the EVTCHNOP_xxx values dense?
In which case an array is almost certainly better than the switch statement.

        David

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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