lkml.org 
[lkml]   [2019]   [Aug]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH v4 5/9] printk-rb: remove extra data buffer size allocation
Date
The buffer for the raw data storage included extra space at the
end for a long. This was meant to guarantee space for the ID of a
wrapping datablock. However, since datablocks are padded and the
dataring is implemented such that no datablock can end at exactly
the end of the data buffer:
DATA_WRAPS(begin) != DATA_WRAPS(next)
there will always be space available for the ID of a wrapping
datablock.

Signed-off-by: John Ogness <john.ogness@linutronix.de>
---
kernel/printk/ringbuffer.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/printk/ringbuffer.h b/kernel/printk/ringbuffer.h
index 462b4d3a3ee2..698d2328ea9e 100644
--- a/kernel/printk/ringbuffer.h
+++ b/kernel/printk/ringbuffer.h
@@ -175,8 +175,7 @@ struct dr_desc *prb_getdesc(unsigned long id, void *arg);
* * descriptor 1 will be the next descriptor
*/
#define DECLARE_PRINTKRB(name, avgdatabits, descbits) \
-char _##name##_data[(1 << ((avgdatabits) + (descbits))) + \
- sizeof(long)] \
+char _##name##_data[1 << ((avgdatabits) + (descbits))] \
__aligned(__alignof__(long)); \
struct prb_desc _##name##_descs[1 << (descbits)] = { \
{ \
--
2.20.1
\
 
 \ /
  Last update: 2019-08-08 00:28    [W:0.475 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site