浏览代码

lockdep: Fix backtraces

Truncate stupid -1 entries in backtraces.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <1248096665.15751.8816.camel@twins>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Peter Zijlstra 16 年之前
父节点
当前提交
4f84f4330a
共有 1 个文件被更改,包括 11 次插入1 次删除
  1. 11 1
      kernel/lockdep.c

+ 11 - 1
kernel/lockdep.c

@@ -367,11 +367,21 @@ static int save_trace(struct stack_trace *trace)
 
 
 	save_stack_trace(trace);
 	save_stack_trace(trace);
 
 
+	/*
+	 * Some daft arches put -1 at the end to indicate its a full trace.
+	 *
+	 * <rant> this is buggy anyway, since it takes a whole extra entry so a
+	 * complete trace that maxes out the entries provided will be reported
+	 * as incomplete, friggin useless </rant>
+	 */
+	if (trace->entries[trace->nr_entries-1] == ULONG_MAX)
+		trace->nr_entries--;
+
 	trace->max_entries = trace->nr_entries;
 	trace->max_entries = trace->nr_entries;
 
 
 	nr_stack_trace_entries += trace->nr_entries;
 	nr_stack_trace_entries += trace->nr_entries;
 
 
-	if (nr_stack_trace_entries == MAX_STACK_TRACE_ENTRIES) {
+	if (nr_stack_trace_entries >= MAX_STACK_TRACE_ENTRIES-1) {
 		if (!debug_locks_off_graph_unlock())
 		if (!debug_locks_off_graph_unlock())
 			return 0;
 			return 0;