From: H. Peter Anvin Date: Tue, 13 Jul 2010 21:57:50 +0000 (-0700) Subject: x86, alternatives: BUG on encountering an invalid CPU feature number X-Git-Tag: v2.6.36-rc1~510^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3b770a2128423a687e6e9c57184a584fb4ba4c77;p=platform%2Fkernel%2Flinux-3.10.git x86, alternatives: BUG on encountering an invalid CPU feature number Make the alternatives-patching code BUG on encountering an invalid CPU feature number. Should have done this a long time ago. Signed-off-by: H. Peter Anvin Cc: Yinghai Lu Cc: Suresh Siddha LKML-Reference: --- diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c index 7023773..f65ab8b 100644 --- a/arch/x86/kernel/alternative.c +++ b/arch/x86/kernel/alternative.c @@ -214,6 +214,7 @@ void __init_or_module apply_alternatives(struct alt_instr *start, u8 *instr = a->instr; BUG_ON(a->replacementlen > a->instrlen); BUG_ON(a->instrlen > sizeof(insnbuf)); + BUG_ON(a->cpuid >= NCAPINTS*32); if (!boot_cpu_has(a->cpuid)) continue; #ifdef CONFIG_X86_64