Re: [PATCH v1 01/11] perf debug: Avoid stack overflow in recursive error message

From: Howard Chu
Date: Thu Feb 27 2025 - 01:04:19 EST


Hello,

On Wed, Feb 26, 2025 at 9:45 PM Ian Rogers <irogers@xxxxxxxxxx> wrote:
>
> On Wed, Feb 26, 2025 at 9:40 PM Howard Chu <howardchu95@xxxxxxxxx> wrote:
> >
> > Hi Ian,
> >
> > On Wed, Jan 8, 2025 at 11:51 PM Ian Rogers <irogers@xxxxxxxxxx> wrote:
> > >
> > > In debug_file, pr_warning_once is called on error. As that function
> > > calls debug_file the function will yield a stack overflow. Switch the
> > > location of the call so the recursion is avoided.
> >
> > May I ask how it created the recursion? Too ignorant to understand sorry...
>
> If _debug_file is NULL then debug_file calls pr_warning_once which
> calls debug_file which calls pr_warning_once again, etc ... :-)

Got it,

pr_warning()
eprintf()
veprintf()
debug_file()

ack.

Thanks,
Howard
>
> Thanks,
> Ian
>
> > Thanks,
> > Howard