]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] x86-64: do not always end the stack trace with ULONG_MAX
authorCatalin Marinas <catalin.marinas@arm.com>
Tue, 13 Feb 2007 12:26:21 +0000 (13:26 +0100)
committerAndi Kleen <andi@basil.nowhere.org>
Tue, 13 Feb 2007 12:26:21 +0000 (13:26 +0100)
It makes more sense to end the stack trace with ULONG_MAX only if
nr_entries < max_entries.  Otherwise, we lose one entry in the long stack
traces and cannot know whether the trace was complete or not.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Cc: Andi Kleen <ak@suse.de>
Cc: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
arch/x86_64/kernel/stacktrace.c

index 6026b31d037ef72a9b92213f1b522b8ba8e8f0b0..65ac2c6b34a6a1f80c9be549572e1d2f2e1d102e 100644 (file)
@@ -32,7 +32,7 @@ static void save_stack_address(void *data, unsigned long addr)
                trace->skip--;
                return;
        }
-       if (trace->nr_entries < trace->max_entries - 1)
+       if (trace->nr_entries < trace->max_entries)
                trace->entries[trace->nr_entries++] = addr;
 }
 
@@ -49,7 +49,8 @@ static struct stacktrace_ops save_stack_ops = {
 void save_stack_trace(struct stack_trace *trace, struct task_struct *task)
 {
        dump_trace(task, NULL, NULL, &save_stack_ops, trace);
-       trace->entries[trace->nr_entries++] = ULONG_MAX;
+       if (trace->nr_entries < trace->max_entries)
+               trace->entries[trace->nr_entries++] = ULONG_MAX;
 }
 EXPORT_SYMBOL(save_stack_trace);