Lines Matching full:index
13 * Sanitize an array index against bounds check bypass attacks aka the
24 * if (index < size) {
25 * index = k_array_index_sanitize(index, size);
26 * data = array[index];
29 * @param index Untrusted array index which has been validated, but not used
31 * @return The original index value if < size, or 0
33 static inline uint32_t k_array_index_sanitize(uint32_t index, uint32_t array_size) in k_array_index_sanitize() argument
36 int32_t signed_index = index, signed_array_size = array_size; in k_array_index_sanitize()
38 /* Take the difference between index and max. in k_array_index_sanitize()
40 * the complement of index, so that we automatically reject any large in k_array_index_sanitize()
48 return index & mask; in k_array_index_sanitize()
52 return index; in k_array_index_sanitize()