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 001D816D33F; Wed, 25 Sep 2024 11:46:28 +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=1727264789; cv=none; b=GMZhj2nEmjmMPJAV7TDZw7DsPW6mhu+ngc1onSDxWlVPkxxh2qd9mbdQO751EfgttfdFV2vnD2TqiHeg+O/DVKZQwYMduwyiBgiMt9fTjJorq78EGBYj86ZzTH9XolKdz6XoYgbWgK58CusRqnWSyOMauwq4uB149Rzn0rgmX14= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727264789; c=relaxed/simple; bh=9C2xkiI+pCr/7yO623HUR+Ghmvk1ezZcoUu8B2wi6tw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qZauNXFYtL8dD8YgwY2/NjaXAEYDVQ3p4JkT/K0eIL3Jl+QA3hR7utfcvg/D/h7Bh26bdx95XazhMYBxfu1f45soApGvZRJW2u95o0+PioybF3d6Leb6BsNq1+mgy5Wj/8c4JCek34Xtf/N0ZsMlmTrzSN8rmOfUPjKMUY+qq9E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sylUrtW5; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="sylUrtW5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B24FC4CEC3; Wed, 25 Sep 2024 11:46:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727264788; bh=9C2xkiI+pCr/7yO623HUR+Ghmvk1ezZcoUu8B2wi6tw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sylUrtW53phzFJB+sGyKuvNoC8R86uDZNrS4MkVxtp7c6wKLvSMndopZfhdmaWvmR h2JPzxLNY4b3j7UTXwUCoA2YhxHHPzBvwT3GuXcq7CRFKEbKMcEKWpEJpy7UlIDwnP kXi6gEF26g5fXGtWhYNF0D3BQ+N5rrnckDruj+7i6+rKW4FFqTTGt0IGa+VtH7j15X r2qte3+IQyusxLi0TcfVTk+/sgcxCzgwm9A9gIiOV5X4Wkeg2cJ5aAQUKdFE/+lUjj 0rWH8gEXIuyb9uEHF1tEjszstXACszRr0CFsmu/ivGi6p89MEpjrOQIcZ8v8YthaWc tg1uM1baVEQKQ== 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, alvin.lee2@amd.com, wayne.lin@amd.com, wenjing.liu@amd.com, george.shen@amd.com, dillon.varone@amd.com, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 6.11 152/244] drm/amd/display: Add NULL check for function pointer in dcn20_set_output_transfer_func Date: Wed, 25 Sep 2024 07:26:13 -0400 Message-ID: <20240925113641.1297102-152-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> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.11 Content-Transfer-Encoding: 8bit From: Srinivasan Shanmugam [ Upstream commit 62ed6f0f198da04e884062264df308277628004f ] This commit adds a null check for the set_output_gamma function pointer in the dcn20_set_output_transfer_func function. Previously, set_output_gamma was being checked for null at line 1030, but then it was being dereferenced without any null check at line 1048. This could potentially lead to a null pointer dereference error 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 at line 1048. 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/dcn20/dcn20_hwseq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c index 17d1c195663a0..7ca0da88290af 100644 --- a/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c +++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c @@ -1044,7 +1044,8 @@ bool dcn20_set_output_transfer_func(struct dc *dc, struct pipe_ctx *pipe_ctx, /* * if above if is not executed then 'params' equal to 0 and set in bypass */ - 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 true; } -- 2.43.0