zoukankan      html  css  js  c++  java
  • gcc -02引起内存溢出'unsigned i'应修订为'volatile unsigned i'

    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);
    }

  • 相关阅读:
    第06组 Alpha冲刺(6/6)
    第06组 Alpha冲刺(5/6)
    第06组 Alpha冲刺(4/6)
    第06组 Alpha冲刺(3/6)
    第06组 Alpha冲刺(2/6)
    第06组 Alpha冲刺(1/6)
    第06组 团队Git现场编程实战
    团队项目-需求分析报告
    团队项目-选题报告
    第二次结对编程作业
  • 原文地址:https://www.cnblogs.com/mull/p/8031748.html
Copyright © 2011-2022 走看看