[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.21.1904141858300.4917@nanos.tec.linutronix.de>
Date: Sun, 14 Apr 2019 19:00:37 +0200 (CEST)
From: Thomas Gleixner <tglx@...utronix.de>
To: Josh Poimboeuf <jpoimboe@...hat.com>
cc: LKML <linux-kernel@...r.kernel.org>, x86@...nel.org,
Andy Lutomirski <luto@...nel.org>,
Steven Rostedt <rostedt@...dmis.org>,
Alexander Potapenko <glider@...gle.com>,
Andrey Ryabinin <aryabinin@...tuozzo.com>,
Dmitry Vyukov <dvyukov@...gle.com>, kasan-dev@...glegroups.com,
linux-mm@...ck.org
Subject: Re: [RFC patch 25/41] mm/kasan: Simplify stacktrace handling
On Sun, 14 Apr 2019, Thomas Gleixner wrote:
> On Wed, 10 Apr 2019, Josh Poimboeuf wrote:
> > On Wed, Apr 10, 2019 at 12:28:19PM +0200, Thomas Gleixner wrote:
> > > Replace the indirection through struct stack_trace by using the storage
> > > array based interfaces.
> > >
> > > Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
> > > Cc: Andrey Ryabinin <aryabinin@...tuozzo.com>
> > > Cc: Alexander Potapenko <glider@...gle.com>
> > > Cc: Dmitry Vyukov <dvyukov@...gle.com>
> > > Cc: kasan-dev@...glegroups.com
> > > Cc: linux-mm@...ck.org
> > > ---
> > > mm/kasan/common.c | 30 ++++++++++++------------------
> > > mm/kasan/report.c | 7 ++++---
> > > 2 files changed, 16 insertions(+), 21 deletions(-)
> > >
> > > --- a/mm/kasan/common.c
> > > +++ b/mm/kasan/common.c
> > > @@ -48,34 +48,28 @@ static inline int in_irqentry_text(unsig
> > > ptr < (unsigned long)&__softirqentry_text_end);
> > > }
> > >
> > > -static inline void filter_irq_stacks(struct stack_trace *trace)
> > > +static inline unsigned int filter_irq_stacks(unsigned long *entries,
> > > + unsigned int nr_entries)
> > > {
> > > - int i;
> > > + unsigned int i;
> > >
> > > - if (!trace->nr_entries)
> > > - return;
> > > - for (i = 0; i < trace->nr_entries; i++)
> > > - if (in_irqentry_text(trace->entries[i])) {
> > > + for (i = 0; i < nr_entries; i++) {
> > > + if (in_irqentry_text(entries[i])) {
> > > /* Include the irqentry function into the stack. */
> > > - trace->nr_entries = i + 1;
> > > - break;
> > > + return i + 1;
> >
> > Isn't this an off-by-one error if "i" points to the last entry of the
> > array?
>
> Yes, copied one ...
Oh, no. The point is that it returns the number of stack entries to
store. So if i == nr_entries - 1, then it returns nr_entries, i.e. all
entries are stored.
Thanks,
tglx
Powered by blists - more mailing lists