From: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>, Petr Mladek <pmladek@suse.com>
Cc: linux-kernel@vger.kernel.org,
Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Subject: Re: [PATCH] printk: fix integer overflow in setup_log_buf()
Date: Wed, 10 Oct 2018 20:31:20 +0900 [thread overview]
Message-ID: <20181010113120.GA3949@tigerII.localdomain> (raw)
In-Reply-To: <20181010103808.882-1-sergey.senozhatsky@gmail.com>
On (10/10/18 19:38), Sergey Senozhatsky wrote:
> The way we calculate free logbuf free space percentage
> overflows signed integer:
>
> int free;
>
> free = __LOG_BUF_LEN - log_next_idx;
> pr_info("early log buf free: %u(%u%%)\n",
> free, (free * 100) / __LOG_BUF_LEN);
>
> We support LOG_BUF_LEN of up to 2G, since setup_log_buf() is called
> during early init logbuf is mostly empty, so
>
> __LOG_BUF_LEN - log_next_idx
>
> is close to 2G. When we multiply it by 100, we overflow signed
> integer value range.
I'm really sorry. The commit message got totally messed up here.
What I meant was 1<<25. I used 2G as a boot param for testing to
set up a proper new_log_buf_len value. And somehow got confused,
I was in a hurry. I'll send a follow up with fixed commit message.
-ss
next prev parent reply other threads:[~2018-10-10 11:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-10 10:38 Sergey Senozhatsky
2018-10-10 11:31 ` Sergey Senozhatsky [this message]
2018-10-10 11:33 ` Sergey Senozhatsky
2018-10-12 9:01 ` Petr Mladek
2018-10-12 9:27 ` Sergey Senozhatsky
2018-10-12 10:33 ` Petr Mladek
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=20181010113120.GA3949@tigerII.localdomain \
--to=sergey.senozhatsky@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=sergey.senozhatsky.work@gmail.com \
/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
all inboxes | Powered by JetHome®