lkml.org 
[lkml]   [2020]   [Oct]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] printk: ringbuffer: Wrong data pointer when appending small string
Date
On 2020-10-15, Sergey Senozhatsky <sergey.senozhatsky@gmail.com> wrote:
>> diff --git a/kernel/printk/printk_ringbuffer.c b/kernel/printk/printk_ringbuffer.c
>> index 2493348a1631..24a960a89aa8 100644
>> --- a/kernel/printk/printk_ringbuffer.c
>> +++ b/kernel/printk/printk_ringbuffer.c
>> @@ -1125,7 +1125,10 @@ static char *data_realloc(struct printk_ringbuffer *rb,
>>
>> /* If the data block does not increase, there is nothing to do. */
>> if (head_lpos - next_lpos < DATA_SIZE(data_ring)) {
>> - blk = to_block(data_ring, blk_lpos->begin);
>> + if (wrapped)
>> + blk = to_block(data_ring, 0);
>> + else
>> + blk = to_block(data_ring, blk_lpos->begin);
>> return &blk->data[0];
>> }
>
> Great catch.

Indeed. I don't know how we missed that one. :-/

Reviewed-by: John Ogness <john.ogness@linutronix.de>

\
 
 \ /
  Last update: 2020-10-15 12:00    [W:0.076 / U:0.304 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site