Re: [PATCH v4 12/20] vsprintf: add new `%pA` format specifier

From: Miguel Ojeda
Date: Mon Feb 14 2022 - 09:05:04 EST


On Mon, Feb 14, 2022 at 12:37 PM David Laight <David.Laight@xxxxxxxxxx> wrote:
>
> Doesn't that stand a reasonable chance of blowing the kernel stack?
>
> vsnprintf() is likely to be on the 'worst case' stack path anyway.
> Anything vaguely like a recursive call, or anything 'stack expensive'
> inside vsnprintf() stands a real chance of overflowing the stack.

There should be no recursion going on, but stack usage could be a
concern depending on what the formatted types attempt to do (thus we
need to be mindful when implementing `Display`) and what the compiler
could possibly generate on a worst case (Gary, bjorn3 et. al. may want
to give details about this).

Cheers,
Miguel