From: John Ogness <john.ogness@linutronix.de>
To: Sergey Senozhatsky <senozhatsky@chromium.org>,
Petr Mladek <pmladek@suse.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>,
coverity-bot <keescook@chromium.org>,
Steven Rostedt <rostedt@goodmis.org>,
linux-kernel@vger.kernel.org,
"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
linux-next@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: Coverity: console_prepend_dropped(): Memory - corruptions
Date: Tue, 17 Jan 2023 08:16:48 +0106 [thread overview]
Message-ID: <877cxl3abr.fsf@jogness.linutronix.de> (raw)
In-Reply-To: <Y8YRBo7ZmtzWT4J1@google.com>
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
next prev parent reply other threads:[~2023-01-17 7:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-13 23:46 Coverity: console_prepend_dropped(): Memory - corruptions coverity-bot
2023-01-14 10:14 ` Sergey Senozhatsky
2023-01-16 16:35 ` Petr Mladek
2023-01-17 3:07 ` Sergey Senozhatsky
2023-01-17 7:10 ` John Ogness [this message]
2023-01-17 7:51 ` Sergey Senozhatsky
2023-01-17 11:20 ` Petr Mladek
2023-01-18 0:35 ` Sergey Senozhatsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877cxl3abr.fsf@jogness.linutronix.de \
--to=john.ogness@linutronix.de \
--cc=gustavo@embeddedor.com \
--cc=keescook@chromium.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=senozhatsky@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox