tracing: fix mmiotrace resizing crash

Pekka reported a crash when resizing the mmiotrace tracer (if only
mmiotrace is enabled).

This happens because in that case we do not allocate the max buffer,
but we try to use it.

Make ring_buffer_resize() idempotent against NULL buffers.

Reported-by: Pekka Paalanen <pq@iki.fi>
Signed-off-by: Ingo Molnar <mingo@elte.hu>

+6
+6
kernel/trace/ring_buffer.c
··· 538 LIST_HEAD(pages); 539 int i, cpu; 540 541 size = DIV_ROUND_UP(size, BUF_PAGE_SIZE); 542 size *= BUF_PAGE_SIZE; 543 buffer_size = buffer->pages * BUF_PAGE_SIZE;
··· 538 LIST_HEAD(pages); 539 int i, cpu; 540 541 + /* 542 + * Always succeed at resizing a non-existent buffer: 543 + */ 544 + if (!buffer) 545 + return size; 546 + 547 size = DIV_ROUND_UP(size, BUF_PAGE_SIZE); 548 size *= BUF_PAGE_SIZE; 549 buffer_size = buffer->pages * BUF_PAGE_SIZE;