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 CFA3819048A; Wed, 25 Sep 2024 11:46:51 +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=1727264811; cv=none; b=nvfRY8OD2OVfRiivYknlf8jkkHc3Uay1OQqjC6ByL5DD65sG8psfivSxlW7xyj6mh2K03N3WNazBvgwyl7aVWlXEOiuVANO8pbbZ6DNQgHtkoe28hveOOYLmbS9M3DSQq92d8tlSZSbnXJa8Efsjsx2SkBrOdYtzkbEb5D7TIbA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727264811; c=relaxed/simple; bh=X434H2i369/R4Ntl7aoS9+xH+XRW69kJvEqua7HfDtI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=I44X8Ph8Kie4kUiZM6KCJrep8F3GTSg3ACuXzSRuYYh8w7JyL4PTYYG/9C43kgK2pOFgtL8yjFvborflwMs+/EoXbEi1To45eD9aHggUTsbB+GDBg7e2BjuGdDX5eouwryA3Ed2kSH7BCY4mZIfPIX+JOBB3AvURD9l/SltwC/8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XsPwofgc; 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="XsPwofgc" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89EBDC4CEC3; Wed, 25 Sep 2024 11:46:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727264811; bh=X434H2i369/R4Ntl7aoS9+xH+XRW69kJvEqua7HfDtI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XsPwofgcB33u4S9TliLfGgqN/34W0uPhzCJll5sHhKuXfG9nJEb9Tebu17WAGdrZU /Lhe+xECBcVXwj1BrBafZ2Ov11joW8wRESvww27+tdSNhctdHQNeOYy52a+BKR0JTf JsGrMk94jRGBp4RHgbCJMytw/vyRYIwC2v6q5KewCMMwBCsOh0ZWBzigwv5AtaZ1VP SlLvAtz8T/z8YSoAxsCyh5qKw9/FRyYQMu8eRGRXP5r78cN/cpE5xe1FguxDj71gr7 jqcYHfj961yBHJCXHe+P5rfuSbdBz0c2wf8vYzIXdNTXy5iI5SfbeoRqYz9GdWup1/ TzGEqQzdxICGg== 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, samson.tam@amd.com, wenjing.liu@amd.com, dillon.varone@amd.com, ilya.bakoulin@amd.com, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 6.11 154/244] drm/amd/display: Add NULL check for function pointer in dcn32_set_output_transfer_func Date: Wed, 25 Sep 2024 07:26:15 -0400 Message-ID: <20240925113641.1297102-154-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: linux-kernel@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 28574b08c70e56d34d6f6379326a860b96749051 ] This commit adds a null check for the set_output_gamma function pointer in the dcn32_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/dcn32/dcn32_hwseq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c index 39fd3f58886c5..f4d05c984b298 100644 --- a/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c +++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c @@ -582,7 +582,9 @@ bool dcn32_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