[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1eddce614f604c518b9bf238a2f92e4b@AcuMS.aculab.com>
Date: Mon, 5 Feb 2018 12:11:07 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Boris Ostrovsky' <boris.ostrovsky@...cle.com>,
Arnd Bergmann <arnd@...db.de>, Juergen Gross <jgross@...e.com>
CC: Nicolas Pitre <nico@...aro.org>, Andi Kleen <ak@...ux.intel.com>,
"Dan Carpenter" <dan.carpenter@...cle.com>,
Jan Beulich <jbeulich@...e.com>,
"xen-devel@...ts.xenproject.org" <xen-devel@...ts.xenproject.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [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
Powered by blists - more mailing lists