From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3D46DC369D4 for ; Wed, 25 Sep 2024 11:46:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D07BC10E914; Wed, 25 Sep 2024 11:46:42 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="qUnlj7LE"; dkim-atps=neutral Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by gabe.freedesktop.org (Postfix) with ESMTPS id 33CEB10E907; Wed, 25 Sep 2024 11:46:41 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 9FBFE5C5967; Wed, 25 Sep 2024 11:46:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9FBA9C4CEC3; Wed, 25 Sep 2024 11:46:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727264800; bh=htlTeJszNSBr+txgmM6ukJitel0z8NzZi/OUCseFMHc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qUnlj7LE84VP8tm2LCtTzKNOa68Es1j5wvZ42EnZIlNtFsSh9PnEWu7WDXkrkIJNY 81VHFQv2a+wcSGMuh3xn+x99D4hP26Askmd6PT14H69Rvk6E2opVT+QrY3ItkDD1ig dotCo6zR43TaEAeo4Msy6lcvdSyFlKKNgzMZkbFG1u2AQY7Zo073zokqTOZIELBUBC QUi8t6T/yOLpoCHWOle6OoiiVr8F5DaQtu8YTnJiFb7n7MyJKM2PVmioi55ydTqZFC rPQ5JZ5CF70wBu/BueqbcG3Afpl8xuN2c2m/+1b5dp+CCX5ieg0hIJ0T7IaeetfiMd 2AI+2LsZ5Q4Vg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Srinivasan Shanmugam , Tom Chung , Rodrigo Siqueira , Roman Li , Alex Hung , Aurabindo Pillai , Harry Wentland , Hamza Mahfooz , Alex Deucher , Sasha Levin , sunpeng.li@amd.com, christian.koenig@amd.com, Xinhui.Pan@amd.com, airlied@gmail.com, daniel@ffwll.ch, sarvinde@amd.com, wenjing.liu@amd.com, nevenko.stupar@amd.com, alvin.lee2@amd.com, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 6.11 153/244] drm/amd/display: Add NULL check for function pointer in dcn401_set_output_transfer_func Date: Wed, 25 Sep 2024 07:26:14 -0400 Message-ID: <20240925113641.1297102-153-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240925113641.1297102-1-sashal@kernel.org> References: <20240925113641.1297102-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.11 Content-Transfer-Encoding: 8bit X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: amd-gfx-bounces@lists.freedesktop.org Sender: "amd-gfx" From: Srinivasan Shanmugam [ Upstream commit dd340acd42c24a3f28dd22fae6bf38662334264c ] This commit adds a null check for the set_output_gamma function pointer in the dcn401_set_output_transfer_func function. Previously, set_output_gamma was being checked for null, but then it was being dereferenced without any null check. This could lead to a null pointer dereference if set_output_gamma is null. To fix this, we now ensure that set_output_gamma is not null before dereferencing it. We do this by adding a null check for set_output_gamma before the call to set_output_gamma. Cc: Tom Chung Cc: Rodrigo Siqueira Cc: Roman Li Cc: Alex Hung Cc: Aurabindo Pillai Cc: Harry Wentland Cc: Hamza Mahfooz Signed-off-by: Srinivasan Shanmugam Reviewed-by: Tom Chung Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c index 537a24ec74c85..7c724cf682840 100644 --- a/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c +++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c @@ -748,7 +748,9 @@ bool dcn401_set_output_transfer_func(struct dc *dc, } } - mpc->funcs->set_output_gamma(mpc, mpcc_id, params); + if (mpc->funcs->set_output_gamma) + mpc->funcs->set_output_gamma(mpc, mpcc_id, params); + return ret; } -- 2.43.0