|
XenevaOS
|
#include <linux/kernel.h>
Go to the source code of this file.
Macros | |
| #define | array_index_nospec(index, size) |
array_index_nospec - sanitize an array index after a bounds check
For a sequence like:
if (index < size) {
index = array_index_nospec(index, size);
val = array[index];
}
if the CPU speculates past the bounds check this clamps the index into [0, size). Used by virtio-rng.c's copy_data() to keep a buggy or malicious virtio-rng backend from steering the memcpy past the end of vi->data.