From patchwork Mon Nov 9 12:55:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 322595 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8367EC388F7 for ; Mon, 9 Nov 2020 13:41:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 25619206B2 for ; Mon, 9 Nov 2020 13:41:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604929272; bh=F8GHRzebh/oQRBKtoP8ooyOEj7+8l3dGNwpH1kCyCuc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=sLib7MDq1/D8L2Rx8xpppRqDTR8/0GRWgUjbYVHIlNRpqUaVguqX0EnxKRK1SIIs3 TsYnLQZ7PsyhuNqfdKU/+JtLMR/e6mfUA50SS4dPIGQPVqJnYuvVgrXstyx+KdoQE0 s4hqtyHv4F78ixU2A8u7ZtpN/zATWtkaHDRGJHRQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730218AbgKINjH (ORCPT ); Mon, 9 Nov 2020 08:39:07 -0500 Received: from mail.kernel.org ([198.145.29.99]:56164 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730205AbgKINDl (ORCPT ); Mon, 9 Nov 2020 08:03:41 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 85B582223C; Mon, 9 Nov 2020 13:03:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604927006; bh=F8GHRzebh/oQRBKtoP8ooyOEj7+8l3dGNwpH1kCyCuc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HbbaBwY3CC3zEDEvVY/V0ChxALWqjsbj6HlJcO5RELeB0fEQlYGUMEk6bu1olJE1y eyPv5f1KUMx8dadWcBvSJwsrwUwBqufaESOf4m/3cWW/ge9aXFwYJ0yx0nsjNViOwq sN+s+Cvq1Cr4aUH6NsGjpxUDkNbxaGhoqzAOYzkM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qiujun Huang , "Steven Rostedt (VMware)" Subject: [PATCH 4.9 077/117] ring-buffer: Return 0 on success from ring_buffer_resize() Date: Mon, 9 Nov 2020 13:55:03 +0100 Message-Id: <20201109125029.339245097@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125025.630721781@linuxfoundation.org> References: <20201109125025.630721781@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Qiujun Huang 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 Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Greg Kroah-Hartman --- 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 @@ -1650,18 +1650,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); @@ -1801,7 +1801,7 @@ int ring_buffer_resize(struct ring_buffe } mutex_unlock(&buffer->mutex); - return size; + return 0; out_err: for_each_buffer_cpu(buffer, cpu) {