[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250905144152.9137-3-d-tatianin@yandex-team.ru>
Date: Fri, 5 Sep 2025 17:41:52 +0300
From: Daniil Tatianin <d-tatianin@...dex-team.ru>
To: Petr Mladek <pmladek@...e.com>
Cc: Daniil Tatianin <d-tatianin@...dex-team.ru>,
linux-kernel@...r.kernel.org,
Steven Rostedt <rostedt@...dmis.org>,
John Ogness <john.ogness@...utronix.de>,
Sergey Senozhatsky <senozhatsky@...omium.org>
Subject: [PATCH v2 2/2] printk_ringbuffer: allow one data block to occupy the entire data ring
We no longer require a trailing id at the end of the data ring, so
there is no reason to check that one fits.
Signed-off-by: Daniil Tatianin <d-tatianin@...dex-team.ru>
---
kernel/printk/printk_ringbuffer.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/kernel/printk/printk_ringbuffer.c b/kernel/printk/printk_ringbuffer.c
index 99989a9ce4b4..cbbd356b085b 100644
--- a/kernel/printk/printk_ringbuffer.c
+++ b/kernel/printk/printk_ringbuffer.c
@@ -397,21 +397,14 @@ static unsigned int to_blk_size(unsigned int size)
*/
static bool data_check_size(struct prb_data_ring *data_ring, unsigned int size)
{
- struct prb_data_block *db = NULL;
-
if (size == 0)
return true;
/*
* Ensure the alignment padded size could possibly fit in the data
- * array. The largest possible data block must still leave room for
- * at least the ID of the next block.
+ * array.
*/
- size = to_blk_size(size);
- if (size > DATA_SIZE(data_ring) - sizeof(db->id))
- return false;
-
- return true;
+ return (to_blk_size(size) <= DATA_SIZE(data_ring));
}
/* Query the state of a descriptor. */
--
2.43.0
Powered by blists - more mailing lists