- int err = backtrace_thread_user(thread, cs->kpuc_frames,
- cs->kpuc_nframes - 1, &cs->kpuc_nframes, &user64, &trunc);
- cs->kpuc_flags = CALLSTACK_KERNEL_WORDS;
- if (user64) {
- cs->kpuc_flags |= CALLSTACK_64BIT;
- }
- if (trunc) {
- cs->kpuc_flags |= CALLSTACK_TRUNCATED;
- }
+ int error = 0;
+ /*
+ * Leave space for the fixup information.
+ */
+ unsigned int maxnframes = cs->kpuc_nframes - 1;
+ unsigned int nframes = backtrace_thread_user(thread, cs->kpuc_frames,
+ maxnframes, &error, &user64, &trunc);
+ cs->kpuc_nframes = MIN(maxnframes, nframes);