From: Petr Mladek <pmladek@suse.com>
To: Wang Wensheng <wsw9603@163.com>
Cc: rostedt@goodmis.org, john.ogness@linutronix.de,
senozhatsky@chromium.org, d-tatianin@yandex-team.ru,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] printk_ringbuffer: Fix space_used() when blk_lpos->next overflows
Date: Tue, 27 Oct 2026 14:50:00 +0100 [thread overview]
Message-ID: <auCsCAXZuYy1gXeO@pathway.suse.cz> (raw)
In-Reply-To: <20261004075755.363989-1-wsw9603@163.com>
On Sun 2026-10-04 15:57:55, Wang Wensheng wrote:
> Since commit 67e1b0052f6b ("printk_ringbuffer: don't needlessly wrap data
> blocks around") blk_lpos is treated as not wrapped when blk_lpos->next
> overflows to the start of data_ring. We use the indices of blk_lpos->next
> and blk_lpos->start to calculate the size of the data_block. This computes
> zero minus a small positive value, resulting in underflow and an
> unexpectedly large value. Simply using the original lpos with wrap-counts
> solves the problem.
>
> Fixes: 67e1b0052f6b ("printk_ringbuffer: don't needlessly wrap data blocks around")
> Signed-off-by: Wang Wensheng <wsw9603@163.com>
Great catch! The fix looks good.
Reviewed-by: Petr Mladek <pmladek@suse.com>
As John explained, fortunately it is not critical because the space
is used only to count the free size when copying messages from
the initial static ring buffer to a bigger one. And the bug
will happen only when there is no free space anyway.
Well, I will still queue it for 7.4 because I am going to create
another pull request anyway.
Best Regards,
Petr
next prev parent reply other threads:[~2026-10-27 13:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-04 7:57 Wang Wensheng
2026-10-19 15:08 ` John Ogness
2026-10-27 13:50 ` Petr Mladek [this message]
2026-10-27 15:02 ` 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=auCsCAXZuYy1gXeO@pathway.suse.cz \
--to=pmladek@suse.com \
--cc=d-tatianin@yandex-team.ru \
--cc=john.ogness@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=senozhatsky@chromium.org \
--cc=wsw9603@163.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®