Re: [PATCH] perf report: auto-detect branch stack sampling mode

From: Ingo Molnar
Date: Tue Mar 06 2012 - 01:28:03 EST



* Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> wrote:

> > Something like this seems to do it for me.
> >
> > offset = addr - sym->start;
> > + len = sym->end - sym->start;
> > + if (offset >= len)
> > + return 0;
> > +
>
> That is my fault, I should have added a BUG_ON() spitting out
> a callchain in this case, as that function shouldn't be called
> if the address is not within its range :-\

Btw., I'd suggest not doing a BUG_ON() but some less destructive
warning: both symbol table errors and sample stream hickups are
common and can lead to essentially arbitrary input data - we
shouldn't crash on that.

Thanks,

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/