Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3210613pxb; Mon, 9 Nov 2020 05:41:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJzJhFOFxVQuEDd/IN0kPlLoBEaB9Vz7C7qpXdt5DtA/CwFWP9DJZfZsksZsDjpK54qZFJLm X-Received: by 2002:a17:906:fa0a:: with SMTP id lo10mr10571217ejb.309.1604929279415; Mon, 09 Nov 2020 05:41:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604929279; cv=none; d=google.com; s=arc-20160816; b=ubMGmcsKPwSP6vjhhtjiIOb/a8ySiGIZbyE/RqyoP3Zfypnpg6AHEtdtnv+qy2rsY+ scVh5lQJtGcph3PHciDbI/5SM/oeQjevQDeBqJ1DsqLb58aN1tfYtVPNVFwWayLQZQHe jxOelh0SIcJI7wXcU67RzR03kQl3ojiCyDwIXryLGPfPEaEwcI7XIorxFoZePbvxuj9A QZItCpmUbuR38rcTezRPm5kRO9Xu0fmpFvpH2GVsPwyyvu08uQvIyHu74+DoNNUs6TI5 ZSh/SkfplRPjl5p0Kb94uGSBvRH8DGbJoU/8/xtagbu2lGqY/rjXIePZQnoXliPxHMDH /P/w== 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=U0qlkhX2Plx2TFf7cz3xmyL33I+oXLGi36szaRnUQoA=; b=ui0wMWRLv6VDePLTrbdm32vzn6cL9U6/eJD1/A10nI0L1azRs4AyIaorUJh+1VdXJp HdeZbJ0qHlqfZJYmksnA73oSwIIh1JktftonaEAEOHIFRIvo4itot6sFkjU6Hxl1iVAX 1UCMVBsirQ9TCrfdOj+RNugT2f+aM9Pn9a7yAQPotBUYwSGB0MBzT5Z89YvAaxkpBh3U bJuTZmZQWh9WNfDuwWYg9lsm8pTkNgGSKYxwSAb2BzNaJGPITIEv2zhSCTfoVUelxafg 3NwC+9DXb36NjOZpVRS7N1kEab2XX4HEUNkAvn3/Tfm3nYdMZQHWb+0NXc24GuC9muPx mTpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HbbaBwY3; 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 hr40si1550655ejc.353.2020.11.09.05.40.56; Mon, 09 Nov 2020 05:41:19 -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=HbbaBwY3; 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 S1730656AbgKINjN (ORCPT + 99 others); Mon, 9 Nov 2020 08:39:13 -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 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 @@ -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) {