aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Hutchings <ben@decadent.org.uk>2012-02-11 17:56:59 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-02-13 18:24:26 -0500
commit70142a9dd154f54f7409871ead86f7d77f2c6576 (patch)
tree03fd5ce309758ae27c0127159e6ab80df998ebd7
parentda5a70f3519fd6f73ece3eea261a861c9a4d6bbd (diff)
x86/cpu: Fix overrun check in arch_print_cpu_modalias()
snprintf() does not return a negative value when truncating. Signed-off-by: Ben Hutchings <ben@decadent.org.uk> Acked-by: Thomas Renninger <trenn@suse.de> Acked-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--arch/x86/kernel/cpu/match.c2
1 files changed, 1 insertions, 1 deletions
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,
67 for (i = 0; i < NCAPINTS*32; i++) { 67 for (i = 0; i < NCAPINTS*32; i++) {
68 if (boot_cpu_has(i)) { 68 if (boot_cpu_has(i)) {
69 n = snprintf(buf, size, ",%04X", i); 69 n = snprintf(buf, size, ",%04X", i);
70 if (n < 0) { 70 if (n >= size) {
71 WARN(1, "x86 features overflow page\n"); 71 WARN(1, "x86 features overflow page\n");
72 break; 72 break;
73 } 73 }