Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sh: stacktrace: Properly terminate the trace entry buffer.

This inserts a ULONG_MAX entry at the end of the valid entries in the
stack trace buffer so the default code doesn't need to scan to the end of
available slots. This also makes the trace buffer termination behaviour
consistent with the other architectures.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>

+4
+4
arch/sh/kernel/stacktrace.c
··· 62 62 unsigned long *sp = (unsigned long *)current_stack_pointer; 63 63 64 64 unwind_stack(current, NULL, sp, &save_stack_ops, trace); 65 + if (trace->nr_entries < trace->max_entries) 66 + trace->entries[trace->nr_entries++] = ULONG_MAX; 65 67 } 66 68 EXPORT_SYMBOL_GPL(save_stack_trace); 67 69 ··· 99 97 unsigned long *sp = (unsigned long *)tsk->thread.sp; 100 98 101 99 unwind_stack(current, NULL, sp, &save_stack_ops_nosched, trace); 100 + if (trace->nr_entries < trace->max_entries) 101 + trace->entries[trace->nr_entries++] = ULONG_MAX; 102 102 } 103 103 EXPORT_SYMBOL_GPL(save_stack_trace_tsk);