lkml.org 
[lkml]   [2018]   [Feb]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH] xen: hypercall: fix out-of-bounds memcpy
Date
From: Arnd Bergmann
> Sent: 05 February 2018 12:37
....
> > Are the EVTCHNOP_xxx values dense?
> > In which case an array is almost certainly better than the switch statement.
>
> They are, yes. PHYSDEVOP_xxx are also consecutive by start at '4'.
> Dan made the same comment earlier, and I replied that my I had
> considered it but went for the more failsafe route. I also verified my
> assumption now that gcc in fact is smart enough to turn this
> into a table by itself:

I've never spotted that optimisation, must be fairly new.

David

\
 
 \ /
  Last update: 2018-02-05 14:59    [W:0.038 / U:8.000 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site