[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181109092810.GF13195@uranus.lan>
Date: Fri, 9 Nov 2018 12:28:11 +0300
From: Cyrill Gorcunov <gorcunov@...il.com>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: LKML <linux-kernel@...r.kernel.org>,
Andrey Vagin <avagin@...il.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...nel.org>
Subject: Re: [PATCH] posix-timers: Use array safe helper when fetching
notification symbolic name
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!
Powered by blists - more mailing lists