summaryrefslogtreecommitdiff
path: root/lib/trace.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/trace.c')
-rw-r--r--lib/trace.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/trace.c b/lib/trace.c
index fb7658b112..9956442fef 100644
--- a/lib/trace.c
+++ b/lib/trace.c
@@ -296,7 +296,8 @@ int __attribute__((no_instrument_function)) trace_init(void *buff,
trace_enabled = 0;
hdr = map_sysmem(CONFIG_TRACE_EARLY_ADDR,
CONFIG_TRACE_EARLY_SIZE);
- end = (char *)&hdr->ftrace[hdr->ftrace_count];
+ end = (char *)&hdr->ftrace[min(hdr->ftrace_count,
+ hdr->ftrace_size)];
used = end - (char *)hdr;
printf("trace: copying %08lx bytes of early data from %x to %08lx\n",
used, CONFIG_TRACE_EARLY_ADDR,