]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
tracing: Fix the checking of stackidx in __ftrace_trace_stack
authorQiujun Huang <hqjagain@gmail.com>
Sat, 31 Oct 2020 08:57:14 +0000 (16:57 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Nov 2020 18:22:12 +0000 (19:22 +0100)
[ Upstream commit 906695e59324635c62b5ae59df111151a546ca66 ]

The array size is FTRACE_KSTACK_NESTING, so the index FTRACE_KSTACK_NESTING
is illegal too. And fix two typos by the way.

Link: https://lkml.kernel.org/r/20201031085714.2147-1-hqjagain@gmail.com
Signed-off-by: Qiujun Huang <hqjagain@gmail.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/trace/trace.c

index 6e2fb7dc41bf3184dc1f019e53289e3bd318b281..1c76a0faf3cd17933ae3e993c986d8ef35430767 100644 (file)
@@ -2611,7 +2611,7 @@ trace_event_buffer_lock_reserve(struct trace_buffer **current_rb,
        /*
         * If tracing is off, but we have triggers enabled
         * we still need to look at the event data. Use the temp_buffer
-        * to store the trace event for the tigger to use. It's recusive
+        * to store the trace event for the trigger to use. It's recursive
         * safe and will not be recorded anywhere.
         */
        if (!entry && trace_file->flags & EVENT_FILE_FL_TRIGGER_COND) {
@@ -2934,7 +2934,7 @@ static void __ftrace_trace_stack(struct trace_buffer *buffer,
        stackidx = __this_cpu_inc_return(ftrace_stack_reserve) - 1;
 
        /* This should never happen. If it does, yell once and skip */
-       if (WARN_ON_ONCE(stackidx > FTRACE_KSTACK_NESTING))
+       if (WARN_ON_ONCE(stackidx >= FTRACE_KSTACK_NESTING))
                goto out;
 
        /*