Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp804604pxb; Tue, 3 Nov 2020 13:01:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJyO7IFu6OyGehZsvCGawSCf1tPHQZN86B9WBVho/Aco0JwYvdm7FEpkE0Tph8da5NcJDrEJ X-Received: by 2002:a17:906:a43:: with SMTP id x3mr17757924ejf.197.1604437307352; Tue, 03 Nov 2020 13:01:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604437307; cv=none; d=google.com; s=arc-20160816; b=RpSjjm7JiC0ScVB5L2meFdwuT5u+KGNukGi0X4zcGOtTukxchI+h1YR7T9K8hsXW1z s7a8PNfUC3uQcGaew2NiVc7h3xrahQjY4pFGgZezfHJUtjV7W0XgkV7JAiLu9k6eKNly MBYuF15rawPdgWP64Elx2pnw6JDjcOgu1WFDDK0qUL0d1yij5RTs85bg1LG2RxwJU0NA C8tLpC6RT+VWBKKEpIOfYkv81ZTudfKUXAS+NJDj01cr71ufSvI44GFCYPYg3RPoLWfB 2fdTZ2CzYOXw5LKu1yuSLqpWpAhqlct5i3Ng5DaWXWdj4hYTlvwHuAm62BMErz8Iy9E3 HqZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MfS23ikMc7VG6az77RC0MEfbMKzWhSQhQlAc5I+0c8Y=; b=Rod5cLE8ViS16AmNkHujqoF6CcrECppf10JxvW2wrpUjpI4cxgEP32rjAlAmeuhfy4 0XlyUclattfuWmviZDxgj/f4tn3PuL3UouXRC8GPbwbqmwVplP4U/2NmeeX7MdyCoRP/ xsPpD5bJ1x+4QznAY+r8iAgyT/X+Qg6w/PEJn2Akl0qF9WFDVTAAp4PMzRXE09buPz5w bLDU/To3c1gIysxs6VZEVfu+n+o4gdM12APE/lairV19cWpi3b1SvSuqpSS1cS0FchlH 6436QCTTdNeJ+XGi05yTBVWJ4BcqdAx5ZZGuxeWOxOxr1rojJsZ3wFlDt1LFruFfON1N s7UA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KLReTbXR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w13si20739ejz.76.2020.11.03.13.01.24; Tue, 03 Nov 2020 13:01:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KLReTbXR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733180AbgKCVAI (ORCPT + 99 others); Tue, 3 Nov 2020 16:00:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:35694 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730777AbgKCVAH (ORCPT ); Tue, 3 Nov 2020 16:00:07 -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 A675A2053B; Tue, 3 Nov 2020 21:00:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437207; bh=HbhROBeTj8JFEwQCHgGwraoxKsYOS6u/wa/SLDO1MS0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KLReTbXRQc+kpWqEYjbHhuOh5khkR+KqyUII9pcckuDWAH3FYZKDpJD68D/UKB1+y 4Yg1574b501yprZtfn5PbqvjWJr8EH4c78vxIpP9Xso5yiEPZG+6Qihy3RaZQ5GSyZ 76/kYvzVX7cR3UTyIGbkcoG0u4gv2CfGGoY6xDKo= 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 5.4 190/214] ring-buffer: Return 0 on success from ring_buffer_resize() Date: Tue, 3 Nov 2020 21:37:18 +0100 Message-Id: <20201103203308.481437673@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203249.448706377@linuxfoundation.org> References: <20201103203249.448706377@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 @@ -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) {