lkml.org 
[lkml]   [2023]   [Jan]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Coverity: console_prepend_dropped(): Memory - corruptions
Date
On 2023-01-17, Sergey Senozhatsky <senozhatsky@chromium.org> wrote:
> On (23/01/16 17:35), Petr Mladek wrote:
>> len = snprintf(scratchbuf, scratchbuf_sz,
>> "** %lu printk messages dropped **\n", dropped);
>
> Wouldn't
>
> if (WARN_ON_ONCE(len + PRINTK_PREFIX_MAX >= outbuf_sz))
> return;
>
> prevent us from doing something harmful?

Sure. But @0len is supposed to contain the number of bytes in
@scratchbuf, which theoretically it does not. snprintf() is the wrong
function to use here, even if there is not real danger in this
situation.

John Ogness

\
 
 \ /
  Last update: 2023-03-26 23:43    [W:0.148 / U:0.324 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site