From: Kris Van Hees Date: Wed, 24 May 2017 05:00:34 +0000 (-0400) Subject: dtrace: ensure ustackdepth returns correct value X-Git-Tag: v4.1.12-111.0.20170907_2225~3^2~3^2~9 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=cc6596c13cb0a56680228ded93a77683cccbeb50;p=users%2Fjedix%2Flinux-maple.git dtrace: ensure ustackdepth returns correct value The implementation for ustackdepth was causing it to always return 1, regardless of the depth of the ustack(). The commit ensures that the underlying code can walk the stack (without actually collecting PCs) and determine the depth. Orabug: 25949692 Signed-off-by: Kris Van Hees Acked-by: Nick Alcock --- diff --git a/dtrace/dtrace_isa.c b/dtrace/dtrace_isa.c index 124806026547a..f2dcd51238866 100644 --- a/dtrace/dtrace_isa.c +++ b/dtrace/dtrace_isa.c @@ -176,11 +176,12 @@ unsigned long dtrace_getufpstack(uint64_t *pcstack, uint64_t *fpstack, dtrace_stacktrace(&st); depth = st.depth; - while (st.depth < st.limit) { - if (pcstack) + if (pcstack) { + while (st.depth < st.limit) { pcstack[st.depth++] = 0; - if (fpstack) - fpstack[st.depth++] = 0; + if (fpstack) + fpstack[st.depth++] = 0; + } } return depth; @@ -231,5 +232,5 @@ int dtrace_getstackdepth(dtrace_mstate_t *mstate, int aframes) int dtrace_getustackdepth(void) { - return dtrace_getufpstack(NULL, NULL, 0); + return dtrace_getufpstack(NULL, NULL, INT_MAX); }