[RFC PATCH v4 5/9] printk-rb: remove extra data buffer size allocation

From: John Ogness
Date: Wed Aug 07 2019 - 18:27:30 EST


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@xxxxxxxxxxxxx>
---
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