diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 5dd9626634b0fc..022940f097b800 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -590,9 +590,12 @@ int trace_get_user(struct trace_parser *parser, const char __user *ubuf, if (isspace(ch)) { parser->buffer[parser->idx] = 0; parser->cont = false; - } else { + } else if (parser->idx < parser->size - 1) { parser->cont = true; parser->buffer[parser->idx++] = ch; + } else { + ret = -EINVAL; + goto out; } *ppos += read;