From: David Laight <David.Laight@ACULAB.COM>
To: "'Boris Ostrovsky'" <boris.ostrovsky@oracle.com>,
Arnd Bergmann <arnd@arndb.de>, Juergen Gross <jgross@suse.com>
Cc: Nicolas Pitre <nico@linaro.org>, Andi Kleen <ak@linux.intel.com>,
"Dan Carpenter" <dan.carpenter@oracle.com>,
Jan Beulich <jbeulich@suse.com>,
"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] xen: hypercall: fix out-of-bounds memcpy
Date: Mon, 5 Feb 2018 12:11:07 +0000 [thread overview]
Message-ID: <1eddce614f604c518b9bf238a2f92e4b@AcuMS.aculab.com> (raw)
In-Reply-To: <aa6e25c7-dc55-a5bf-39cb-8b9453604111@oracle.com>
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
next prev parent reply other threads:[~2018-02-05 12:10 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-02 15:32 [PATCH] xen: hypercall: fix out-of-bounds memcpy Arnd Bergmann
2018-02-02 15:53 ` Dan Carpenter
2018-02-02 16:11 ` Arnd Bergmann
2018-02-02 16:34 ` Dan Carpenter
2018-02-02 23:33 ` Boris Ostrovsky
2018-02-03 15:12 ` Arnd Bergmann
2018-02-03 17:08 ` Boris Ostrovsky
2018-02-04 15:35 ` Arnd Bergmann
2018-02-04 18:55 ` Boris Ostrovsky
2018-02-05 12:11 ` David Laight [this message]
2018-02-05 12:37 ` Arnd Bergmann
2018-02-05 13:58 ` David Laight
2018-02-05 14:18 ` Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1eddce614f604c518b9bf238a2f92e4b@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=ak@linux.intel.com \
--cc=arnd@arndb.de \
--cc=boris.ostrovsky@oracle.com \
--cc=dan.carpenter@oracle.com \
--cc=jbeulich@suse.com \
--cc=jgross@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nico@linaro.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox