From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 01D8E3EDADF; Tue, 17 Mar 2026 16:42:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773765742; cv=none; b=YRrjFrr17TbR4Q+ciSf284Ap9Jo/K09PT6X4av8+wdqVzbbbUqET+cSGk/NTB6qxiOLFutTvwlCHzOGxOsfZzkzSHhQqv5ghnpvYNMus+04bYtLPCkJTUFNHWosPqJEknvQnAnrdA+Y5YKHYJBYs33uWwCx6VbSOhno6MqGvSac= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773765742; c=relaxed/simple; bh=6yVLH/tX8QFR7alH7W7pnJTGc206Udk892KQTLwvQkg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RfKBxd7sPjhgyL1elRcz6a/BrNS9jsYO9cGFMqnN9XgQBP4wkJD8WF1P9xG3wVohXQdgacft/TR8OkKN3JRHxdIZiBOGi1bBswV0xHUB167ciD4cyLl7m3HU/ejSzUl7UhDDkRG/CpQq9NaS/Nlu4Vx2zuNlAKAJQLDgSoTe/+0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=w0Dflu3o; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="w0Dflu3o" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85317C4CEF7; Tue, 17 Mar 2026 16:42:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1773765741; bh=6yVLH/tX8QFR7alH7W7pnJTGc206Udk892KQTLwvQkg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w0Dflu3oZBGgoGVjfOV+gWwsb36mMVL2QcTRXZGoQQi2d4gYlDpkcNCX2HNP6hXmL ptgaAhVQsoDssN04afsIENxmvSnLJVeY2GpITN7mOJMh+bKpBvCHtiU/jcDgPvblJs qO8H7VLO/1ac/3cTuwqppqORPvp6YKmzPMi2KoMI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ian Rogers , Chen Ni , Adrian Hunter , Alexander Shishkin , Ingo Molnar , James Clark , Jiri Olsa , Mark Rutland , Namhyung Kim , Peter Zijlstra , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 6.19 084/378] perf ftrace: Fix hashmap__new() error checking Date: Tue, 17 Mar 2026 17:30:41 +0100 Message-ID: <20260317163010.106323385@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260317163006.959177102@linuxfoundation.org> References: <20260317163006.959177102@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Chen Ni [ Upstream commit be34705aa527872e5ce83927b7bc9307ba8095ca ] The hashmap__new() function never returns NULL, it returns error pointers. Fix the error checking to match. Additionally, set ftrace->profile_hash to NULL on error, and return the exact error code from hashmap__new(). Fixes: 0f223813edd051a5 ("perf ftrace: Add 'profile' command") Suggested-by: Ian Rogers Signed-off-by: Chen Ni Cc: Adrian Hunter Cc: Alexander Shishkin Cc: Ingo Molnar Cc: James Clark Cc: Jiri Olsa Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/builtin-ftrace.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c index 6b6eec65f93f5..4cc33452d79b6 100644 --- a/tools/perf/builtin-ftrace.c +++ b/tools/perf/builtin-ftrace.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -1209,8 +1210,12 @@ static int prepare_func_profile(struct perf_ftrace *ftrace) ftrace->graph_verbose = 0; ftrace->profile_hash = hashmap__new(profile_hash, profile_equal, NULL); - if (ftrace->profile_hash == NULL) - return -ENOMEM; + if (IS_ERR(ftrace->profile_hash)) { + int err = PTR_ERR(ftrace->profile_hash); + + ftrace->profile_hash = NULL; + return err; + } return 0; } -- 2.51.0