From nobody Sun Feb 8 23:37:09 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 02FC6176220; Fri, 5 Jul 2024 21:06:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720213610; cv=none; b=R3NJ2tg1mmN32Ud9YwaLyiuyjvdkzWIDxy23Tl4O4TNdI4nrsXRmlszN7b7wfe5en0UzFDYtGyraoP0UsA6iMHhFPXtfyKg/TGgyzZLnVeu+prfpiV/pCZ3bGsyjcUqn4+n6IEaNJpRvy4RE8aI7AOUEKB5Iq197mjrCYfQMGx0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720213610; c=relaxed/simple; bh=0RqY3FwLpkLsLtMGcOtgePMIryjxJnEcgowHUKp0lyE=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=gXATIPv1M3Y2JxLtItnNCKHR/EE5XO3xU3gjTh8PRodGAbRN1bk8KqYE51fA6fgqCM2CM/nfBw0Hw5YUcIeRWhoGrkFmM/xwqu1TCHsvnQoZYpFIUk1bIGSRutbkZJMz9KDEXHBqP5HKmIh2n9YkurysCIXvYRIMgt3g/Xo5XeA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=w9IUhUeM; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=WNW1uWdb; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="w9IUhUeM"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="WNW1uWdb" Date: Fri, 05 Jul 2024 21:06:45 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1720213605; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AKjupNNatHtjyUZRVKZRQelXjKCdFRKgiJDw9awryJs=; b=w9IUhUeM8kLQNQbZPAp3mZFAkDrxh6WACfCvSZm8laiWb/oDf/qh7ltvF2OkPSZ8QrnArA NJb+ka8gi/R75b7G+t6JycRLR4R8o8Pen/s/VEgMcYx9dEkA6mK0aUFeJW6n/AoXGMkxsA ce3lc9TC7Cj5Pcd7ec4D4Mqf8x+v9Y13pfDxz3ngbOOCEGlrdtzpW43gAdklq1jtjst81H YMuUdg+iDNgTqV5oyoUvgPU7QJixopIwUboUUxmn2uRpCfX3ZPe8KrnumXJZD3sYz55D57 Zmx8zV9q3qoUTqdpfIMkKbSVdb5K968jPWRhIHIvKmZ5UPtO83r5y6yQOEh6sA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1720213605; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AKjupNNatHtjyUZRVKZRQelXjKCdFRKgiJDw9awryJs=; b=WNW1uWdbFIV9Qea2bQwQjdi35/2q96+BMZ9sGx6chnvIG2n/obax9mpTUqkd6vCBQjuJss YtxkpUttpxOb1dDA== From: "tip-bot2 for Adrian Hunter" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/core] perf: Make rb_alloc_aux() return an error immediately if nr_pages <= 0 Cc: Adrian Hunter , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240624201101.60186-8-adrian.hunter@intel.com> References: <20240624201101.60186-8-adrian.hunter@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <172021360515.2215.12296641761413803609.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the perf/core branch of tip: Commit-ID: 0ca4da2412da05fb9dd0b5d90dcc8026219f0f29 Gitweb: https://git.kernel.org/tip/0ca4da2412da05fb9dd0b5d90dcc80262= 19f0f29 Author: Adrian Hunter AuthorDate: Mon, 24 Jun 2024 23:11:01 +03:00 Committer: Peter Zijlstra CommitterDate: Thu, 04 Jul 2024 16:00:23 +02:00 perf: Make rb_alloc_aux() return an error immediately if nr_pages <=3D 0 rb_alloc_aux() should not be called with nr_pages <=3D 0. Make it more robu= st and readable by returning an error immediately in that case. Signed-off-by: Adrian Hunter Signed-off-by: Peter Zijlstra (Intel) Link: https://lore.kernel.org/r/20240624201101.60186-8-adrian.hunter@intel.= com --- kernel/events/ring_buffer.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c index 485cf0a..8cadf97 100644 --- a/kernel/events/ring_buffer.c +++ b/kernel/events/ring_buffer.c @@ -682,6 +682,9 @@ int rb_alloc_aux(struct perf_buffer *rb, struct perf_ev= ent *event, if (!has_aux(event)) return -EOPNOTSUPP; =20 + if (nr_pages <=3D 0) + return -EINVAL; + if (!overwrite) { /* * Watermark defaults to half the buffer, and so does the