Re: [PATCH v2 1/1] ftrace: do not update max buffer with no users

From: Ingo Molnar
Date: Thu Nov 13 2008 - 09:01:34 EST



* Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:

>
> On Thu, 13 Nov 2008, Ingo Molnar wrote:
> >
> > the obvious solution is to add this to ring_buffer_resize():
> >
> > if (!buffer)
> > return size;
>
> Having a NULL buffer return a successful resize is a bit worrisome to me.
>
> And looking at the code I was trying to make sure could never be called
> if there are no max_tr users:
>
> in update_max_tr
>
> buf = tr->buffer;
> tr->buffer = max_tr.buffer;
> max_tr.buffer = buf;
>
> Should all the ring buffer API return success on NULL pointers?

well, update_max_tr() is only used from tracers which also actually
allocate a max trace buffer: irqs/preemptoff, sched-wakeup.

So, can you tell me any way how the patch below could be broken?

Ingo

------------->