lkml.org 
[lkml]   [2020]   [Nov]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.4 190/214] ring-buffer: Return 0 on success from ring_buffer_resize()
    Date
    From: Qiujun Huang <hqjagain@gmail.com>

    commit 0a1754b2a97efa644aa6e84d1db5b17c42251483 upstream.

    We don't need to check the new buffer size, and the return value
    had confused resize_buffer_duplicate_size().
    ...
    ret = ring_buffer_resize(trace_buf->buffer,
    per_cpu_ptr(size_buf->data,cpu_id)->entries, cpu_id);
    if (ret == 0)
    per_cpu_ptr(trace_buf->data, cpu_id)->entries =
    per_cpu_ptr(size_buf->data, cpu_id)->entries;
    ...

    Link: https://lkml.kernel.org/r/20201019142242.11560-1-hqjagain@gmail.com

    Cc: stable@vger.kernel.org
    Fixes: d60da506cbeb3 ("tracing: Add a resize function to make one buffer equivalent to another buffer")
    Signed-off-by: Qiujun Huang <hqjagain@gmail.com>
    Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    kernel/trace/ring_buffer.c | 8 ++++----
    1 file changed, 4 insertions(+), 4 deletions(-)

    --- a/kernel/trace/ring_buffer.c
    +++ b/kernel/trace/ring_buffer.c
    @@ -1717,18 +1717,18 @@ int ring_buffer_resize(struct ring_buffe
    {
    struct ring_buffer_per_cpu *cpu_buffer;
    unsigned long nr_pages;
    - int cpu, err = 0;
    + int cpu, err;

    /*
    * Always succeed at resizing a non-existent buffer:
    */
    if (!buffer)
    - return size;
    + return 0;

    /* Make sure the requested buffer exists */
    if (cpu_id != RING_BUFFER_ALL_CPUS &&
    !cpumask_test_cpu(cpu_id, buffer->cpumask))
    - return size;
    + return 0;

    nr_pages = DIV_ROUND_UP(size, BUF_PAGE_SIZE);

    @@ -1868,7 +1868,7 @@ int ring_buffer_resize(struct ring_buffe
    }

    mutex_unlock(&buffer->mutex);
    - return size;
    + return 0;

    out_err:
    for_each_buffer_cpu(buffer, cpu) {

    \
     
     \ /
      Last update: 2020-11-03 22:00    [W:4.593 / U:0.172 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site