[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <875z7bhks1.fsf@jogness.linutronix.de>
Date: Thu, 15 Oct 2020 12:05:42 +0206
From: John Ogness <john.ogness@...utronix.de>
To: Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Petr Mladek <mladek.petr@...il.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Steven Rostedt <rostedt@...dmis.org>,
Linux-Next Mailing List <linux-next@...r.kernel.org>,
linux-mm <linux-mm@...ck.org>,
open list <linux-kernel@...r.kernel.org>,
lkft-triage@...ts.linaro.org, LTP List <ltp@...ts.linux.it>,
Andrew Morton <akpm@...ux-foundation.org>,
Mike Rapoport <rppt@...ux.ibm.com>,
Stephen Rothwell <sfr@...b.auug.org.au>,
Rasmus Villemoes <rasmus.villemoes@...vas.dk>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Thomas Gleixner <tglx@...utronix.de>,
Naresh Kamboju <naresh.kamboju@...aro.org>
Subject: Re: [PATCH] printk: ringbuffer: Wrong data pointer when appending small string
On 2020-10-15, Sergey Senozhatsky <sergey.senozhatsky@...il.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@...utronix.de>
Powered by blists - more mailing lists