On Fri, Nov 09, 2018 at 10:18:25AM +0100, Thomas Gleixner wrote:
> > +   nidx = array_index_nospec(notify & ~SIGEV_THREAD_ID, ARRAY_SIZE(nstr));
> 
> I completely understand your intention, but this is misleading. The above
> is really not a speculation gadget.
> 
> I'd rather do an open coded check here and fail the thing instead of
> printing wrong information:
> 
>          nidx = timer->it_sigev_notify & ~SIGEV_THREAD_ID;
>          if (nidx >= ARRAY_SIZE(nstr))
>               return -EINVAL;

Yes, I thought about such approach and did the similar code
in first place, then I dropped it because didn't want additional
"if"s here (your fix in the former commit already does all verification
needed). But thinking more I agree: this code is not time critical
and spending a few cycles won't hurt much. Will update, thanks Thomas!

Reply via email to