Re: [PATCH v3 1/5] KVM: stats: Support linear and logarithmic histogram statistics
From: Paolo Bonzini <pbonzini@redhat.com>
Date: 2021-08-11 10:53:25
From: Paolo Bonzini <pbonzini@redhat.com>
Date: 2021-08-11 10:53:25
On 02/08/21 18:56, Jing Zhang wrote:
+ index = array_index_nospec(index, size); + ++data[index];
This would have to use index = min(index, size-1); index = array_index_nospec(index, size); But thinking more about it there should be no way to do *two* consecutive accesses. Thus, it would be possible to bring an out of bounds element of data[] in the cache, but it would not be possible to deduce its value. This might have to be taken into account when adding more statistics, but for now I've simply replaced array_index_nospec with the min() above. Paolo