On 02/11/2013 03:18 AM, Borislav Petkov wrote: > > +#define __BUG_CHECK_BIT(bit) \ > +({ \ > + WARN_ON(bit >> 5 < NCAPINTS); \ > + bit; \ > +}) > +
Do we need this? Either way, if we do, I would suggest doing something like: if (__builtin_constant_p(bit)) bad_bug_number(); ... and flag bad_bug_number as a compile time error, since the vast majority of the time the bit number will be constant. However, I don't think it is necessary. In order for this to ever trigger someone must have known they were testing for a bug, and yet not used the X86_BUG_ macros, which seems very unlikely. > #define X86_BUG_F00F (NCAPINTS*32+ 0) /* Intel F00F bug */ > #define X86_BUG_FDIV (NCAPINTS*32+ 1) /* FPU FDIV bug */ > +#define X86_BUG_COMA (NCAPINTS*32+ 2) /* Cyrix 6x86 coma */ Just to make it a bit cleaner once we have more than one word of bug tests, I would suggest macroizing this: #define X86_BUG(x) (NCAPINTS*32 + (x)) ... and then just ... #define X86_BUG_F00F X86_BUG(0) #define X86_BUG_FDIV X86_BUG(1) ... and so on. The only reason we *don't* do that with the features is that they tend to come chunkwise in the form of CPUID words. -hpa -- 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/