Search notes:

include/linux/nospec.h

array_index_nospec

array_index_nospec(index, size) is a macro to sanitize an array index after a bounds check.
This macro is used, for example, in do_syscall_x64:
  … 
  if (likely(unr < NR_syscalls)) {

     unr = array_index_nospec(unr, NR_syscalls);
     regs->ax = x64_sys_call(regs, unr);
     return true;

  }
  return false;
 …

Index