提交 70142a9d 编写于 作者: B Ben Hutchings 提交者: Greg Kroah-Hartman

x86/cpu: Fix overrun check in arch_print_cpu_modalias()

snprintf() does not return a negative value when truncating.
Signed-off-by: NBen Hutchings <ben@decadent.org.uk>
Acked-by: NThomas Renninger <trenn@suse.de>
Acked-by: NH. Peter Anvin <hpa@zytor.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 da5a70f3
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册