Re: [PATCH 1/1] nospec: Add documentation for array_index_nospec

From: Jordy Zomer
Date: Fri Jun 16 2023 - 14:47:19 EST


Thanks both, I was planning on doing some plumbing next week to fix the
already affected calls and then add a BUILD_BUG_ON() in combination with
__builtin_constant_p() to prevent misuse from happening in the future. In
addition I'll send a V2 next week to fix the spelling/wording issue.

Cheers,

Jordy

On Fri, Jun 16, 2023 at 8:05 PM Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:
>
> On Fri, Jun 16, 2023 at 01:37:35PM +0000, Jordy Zomer wrote:
> > +Please note that this function should only be used if the upper
> > +boundary is a built-time constant, otherwise this could be
> > +speculated on as well. If this is not the case please refer to
> > +barrier_nospec().
>
> "build time", not "built time". Also, "Please note that" doesn't
> really add any value. You can just write:
>
> This function should only be used if the upper boundary is a build-time
> constant, otherwise this could be speculated on as well. If it is not
> a constant, use barrier_nospec() instead.
>