2017-12-13 10:44:19
gcc -02引起内存溢出'unsigned i'应修订为'volatile unsigned i'
1.3.100 driver/char/random.c
static inline void add_entropy_word(struct random_bucket *r,
const __u32 input)
{
volatile unsigned i; //old : unsigned i;
__u32 w;
w = (input << r->input_rotate) | (input >> (32 - r->input_rotate));
i = r->add_ptr = (r->add_ptr - 1) & (POOLWORDS-1);
if (i)
r->input_rotate = (r->input_rotate + 7) & 31;
else
/*
* At the beginning of the pool, add an extra 7 bits
* rotation, so that successive passes spread the
* input bits across the pool evenly.
*/
r->input_rotate = (r->input_rotate + 14) & 31;
/* XOR in the various taps */
w ^= r->pool[(i+TAP1)&(POOLWORDS-1)];
w ^= r->pool[(i+TAP2)&(POOLWORDS-1)];
w ^= r->pool[(i+TAP3)&(POOLWORDS-1)];
w ^= r->pool[(i+TAP4)&(POOLWORDS-1)];
w ^= r->pool[(i+TAP5)&(POOLWORDS-1)];
w ^= r->pool[i];
/* Rotate w left 1 bit (stolen from SHA) and store */
r->pool[i] = (w << 1) | (w >> 31);
}