From: Ben Hutchings Date: Sat, 11 Feb 2012 22:56:59 +0000 (+0000) Subject: x86/cpu: Fix overrun check in arch_print_cpu_modalias() X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=70142a9dd154f54f7409871ead86f7d77f2c6576;p=linux-beck.git x86/cpu: Fix overrun check in arch_print_cpu_modalias() snprintf() does not return a negative value when truncating. Signed-off-by: Ben Hutchings Acked-by: Thomas Renninger Acked-by: H. Peter Anvin Signed-off-by: Greg Kroah-Hartman --- diff --git a/arch/x86/kernel/cpu/match.c b/arch/x86/kernel/cpu/match.c index 940e2d483076..2dfa52bcdfe2 100644 --- a/arch/x86/kernel/cpu/match.c +++ b/arch/x86/kernel/cpu/match.c @@ -67,7 +67,7 @@ ssize_t arch_print_cpu_modalias(struct device *dev, for (i = 0; i < NCAPINTS*32; i++) { if (boot_cpu_has(i)) { n = snprintf(buf, size, ",%04X", i); - if (n < 0) { + if (n >= size) { WARN(1, "x86 features overflow page\n"); break; }