lkml.org 
[lkml]   [2020]   [Sep]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH printk 3/5] printk: use buffer pool for sprint buffers
On Thu 2020-09-24 14:40:58, Sergey Senozhatsky wrote:
> On (20/09/23 17:11), Petr Mladek wrote:
> >
> > AFAIK, there is one catch. We need to use va_copy() around
> > the 1st call because va_format can be proceed only once.
> >
>
> Current printk() should be good enough for reporting, say, "Kernel
> stack overflow" errors. Is extra pressure that va_copy() adds something
> that we need to consider?

The thing is that vsprintf() traverses the arguments using va_arg().
It modifies internal values so that the next va_arg() will read
the next value.

If we want to call vsprintf() twice then we need to reset the internal
va_list states. My understanding is that va_copy() is the only legal
way when we are already nested inside va_start()/va_end().

See also the commit 5756b76e4db643d8f7 ("vsprintf: make %pV handling
compatible with kasprintf()").

Best Regards,
Petr

\
 
 \ /
  Last update: 2020-09-24 10:46    [W:0.221 / U:17.288 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site