* Len Brown <l...@kernel.org> wrote:

>  void x86_init_rdrand(struct cpuinfo_x86 *c)
>  {
>  #ifdef CONFIG_ARCH_RANDOM
>       unsigned long tmp;
> -     int i, count, ok;
> +     int i;
>  
>       if (!cpu_has(c, X86_FEATURE_RDRAND))
> -             return;         /* Nothing to do */
> +             return;
>  
> -     for (count = i = 0; i < RESEED_LOOP; i++) {
> -             ok = rdrand_long(&tmp);
> -             if (ok)
> -                     count++;
> +     for (i = 0; i < SANITY_CHECK_LOOPS; i++) {
> +             if (!rdrand_long(&tmp)) {
> +                     clear_cpu_cap(c, X86_FEATURE_RDRAND);
> +                     return;

So here we should emit a printk_once() warning that something's fishy, instead 
of 
silently disabling a CPU feature.

Thanks,

        Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to