tracing: fix mmiotrace resizing crash
[sfrench/cifs-2.6.git] / kernel / trace / ring_buffer.c
index 231db209fa82137461efbd51eb15a8061d6437a6..036456cbb4f7e1ceecf929e37ed6de581866abda 100644 (file)
@@ -538,6 +538,12 @@ int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size)
        LIST_HEAD(pages);
        int i, cpu;
 
+       /*
+        * Always succeed at resizing a non-existent buffer:
+        */
+       if (!buffer)
+               return size;
+
        size = DIV_ROUND_UP(size, BUF_PAGE_SIZE);
        size *= BUF_PAGE_SIZE;
        buffer_size = buffer->pages * BUF_PAGE_SIZE;