From nobody Tue Dec 2 02:31:07 2025 Received: from mailtransmit04.runbox.com (mailtransmit04.runbox.com [185.226.149.37]) (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 2700831A549 for ; Wed, 19 Nov 2025 22:42:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.226.149.37 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763592175; cv=none; b=CDeFAIN9F2E8J57m7l9rCNKoJ1FEhiKVYhhoeAQo8vyctn84hp4qTH7KGwFvKeV85PbYOr4uPeWWSbSocZvbdMFvGi5xVlYC/AsRqwWTm2f3qYTNRtMbw5zOSrXyuISP4+nO+wdB6yvXY5jSZkjJ3HMZGs1r1EAA8O3LO2yH24I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763592175; c=relaxed/simple; bh=li52uobPk66+BkwIH/b8VJKjGDYh3+gh2uWOK3B772E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Ftv4HB5+GLmt/5GTTguCcqDIFxhvaM9fnalzxo3C8C4rWad1zP/EHNV2Z5vKy7ndDeC1H9f+u06rZItHZjvPbJDUsDnw0tEUhisOzKCtNc13SEElVXCg7iukDOP2D7f68nowXu2WEX5mghmBYk6eQDDmAqUm23mthyE3qZmI6XI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=runbox.com; dkim=pass (2048-bit key) header.d=runbox.com header.i=@runbox.com header.b=DGUWUnvz; arc=none smtp.client-ip=185.226.149.37 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=runbox.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=runbox.com header.i=@runbox.com header.b="DGUWUnvz" Received: from mailtransmit02.runbox ([10.9.9.162] helo=aibo.runbox.com) by mailtransmit04.runbox.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1vLqt0-006ywJ-Tp; Wed, 19 Nov 2025 23:42:50 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; s=selector1; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To :Message-Id:Date:Subject:Cc:To:From; bh=N1DxFU65G+nM7q0zov0KSr3WF0ez8nK/PjfzsNDA87s=; b=DGUWUnvzyRp3eBNft6KMmq33+r cqzFxHUt1cMknmNzAL0QK0DdLp7DRfT/3Cj2QO9XgbvpOzu6XPMDzjz4TtMdxFGHgcmx8VPz0qUoM POrh0zfp3/9JbKuncjnr05y1RaYfnJ8OjYAnSj8NGE5Z3uQ2/heQ4SjGigBs6Bu+TvGbfPU2qTgHR UeGPfULMqTboFHcEKrSLWXXf0oBLw1+++XgdPlUii6w+jsK6ITl56xerANPGwyF+uVaWX/nOOJbJm 5svE9KfLf7Srtp0RdeqynV4E/5FzJskMjBRlNFtoiODpcx4OMiDuQMhKc+kyt5oX9UM0ilLa72+e+ 7cF7cbYA==; Received: from [10.9.9.74] (helo=submission03.runbox) by mailtransmit02.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1vLqt0-00086M-KX; Wed, 19 Nov 2025 23:42:50 +0100 Received: by submission03.runbox with esmtpsa [Authenticated ID (1493616)] (TLS1.2:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.93) id 1vLqsV-00Fos6-DY; Wed, 19 Nov 2025 23:42:19 +0100 From: david.laight.linux@gmail.com To: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Cc: Arnaldo Carvalho de Melo , Ingo Molnar , Namhyung Kim , Peter Zijlstra , David Laight Subject: [PATCH 03/44] perf: Fix branch stack callchain limit Date: Wed, 19 Nov 2025 22:40:59 +0000 Message-Id: <20251119224140.8616-4-david.laight.linux@gmail.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20251119224140.8616-1-david.laight.linux@gmail.com> References: <20251119224140.8616-1-david.laight.linux@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: David Laight The code that bounds the brs->nr to event->attr.sample_max_stack incorrectly masks brs->nr with 65535 before the limit check. Replace the min_t(u16, ...) with a plain min(...). I guess there may be another limit on brs->nr (which is u64). Fixes: c53e14f1ea4a8 ("perf: Extend per event callchain limit to branch sta= ck") Signed-off-by: David Laight Reviewed-by: Dapeng Mi --- include/linux/perf_event.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index fd1d91017b99..f91c875ea311 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -1430,7 +1430,7 @@ static inline void perf_sample_save_brstack(struct pe= rf_sample_data *data, if (branch_sample_hw_index(event)) size +=3D sizeof(u64); =20 - brs->nr =3D min_t(u16, event->attr.sample_max_stack, brs->nr); + brs->nr =3D min(event->attr.sample_max_stack, brs->nr); =20 size +=3D brs->nr * sizeof(struct perf_branch_entry); =20 --=20 2.39.5