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 A54611CAC2C; Wed, 25 Sep 2024 12:07:12 +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=1727266032; cv=none; b=Iu/nIJDAVRxHqEeI/2z7uXEPKDxaqjVxLUIjmEce3djNFQL+MfyrOq5GaNJMC/3gyyA7BWtO84jgsJUaaDqrIeBhkTiqBHJtS+emkERAM1QFr2eldchnhfyfLtjsSWy0jsEVypPCUJWpLwIiHUap8wUUNGACU7RSVSo7dVC1xUo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727266032; c=relaxed/simple; bh=RAGSkXWuKFUFwcxyIZ3t1x8TvDIpRJx22tAg6NSoFUM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ST7C0+QU9q2cH2nmaqn2JAwec9GC0mxhwBoeE8Ef/GlIB73AE3XInL5hVkBqbrZrNKnjKCUUz8e6LVNkt06tNXe92ks9Ca7Se5C26aLhi7HmiYeVO+QtJUTS/p4eiLzOJ8u4vb5XmHr1VOyvR/Fj6Ya2MjVO4bgcsE1rodsgkok= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Hy5jShtW; 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="Hy5jShtW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D592C4CEC7; Wed, 25 Sep 2024 12:07:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727266032; bh=RAGSkXWuKFUFwcxyIZ3t1x8TvDIpRJx22tAg6NSoFUM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hy5jShtW9l8BY7I14mbrrlYyP3QguIwAuw86Zw7IaY7a7xys5VNPI0y47akTo3/pu 0K7Z8BXF9m2rOdryBs7PTh4ApnPHI5dbYkuuiq+qqRA2YPGsYrnK/23g6SI3mqjC+v PFuxsQqWfz4jFbGCqUUTzRk0NkCD0OwUUEYgbylD+7aUvNQAfCWcGa+pZAiHPwuTxn 4N+SU+cXyZ/65yqxbjGe/tOLOtzGoWJBDX99VphnQxudIxPG3jJyi8hsLOOt/QrY0L Iofh4omUBAD39K537t/F8+LbChIH6BT9mfuRBmHR8G4XaHYifOunrFZLT/eZLkG3t+ zqmHJzYcfIzyw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Alex Hung , Rodrigo Siqueira , Jerry Zuo , Daniel Wheeler , Alex Deucher , Sasha Levin , harry.wentland@amd.com, sunpeng.li@amd.com, Rodrigo.Siqueira@amd.com, christian.koenig@amd.com, Xinhui.Pan@amd.com, airlied@gmail.com, daniel@ffwll.ch, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 6.10 152/197] drm/amd/display: Check link_res->hpo_dp_link_enc before using it Date: Wed, 25 Sep 2024 07:52:51 -0400 Message-ID: <20240925115823.1303019-152-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240925115823.1303019-1-sashal@kernel.org> References: <20240925115823.1303019-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.10.11 Content-Transfer-Encoding: 8bit From: Alex Hung [ Upstream commit 0beca868cde8742240cd0038141c30482d2b7eb8 ] [WHAT & HOW] Functions dp_enable_link_phy and dp_disable_link_phy can pass link_res without initializing hpo_dp_link_enc and it is necessary to check for null before dereferencing. This fixes 2 FORWARD_NULL issues reported by Coverity. Reviewed-by: Rodrigo Siqueira Signed-off-by: Jerry Zuo Signed-off-by: Alex Hung Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- .../gpu/drm/amd/display/dc/link/hwss/link_hwss_hpo_dp.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/amd/display/dc/link/hwss/link_hwss_hpo_dp.c b/drivers/gpu/drm/amd/display/dc/link/hwss/link_hwss_hpo_dp.c index e1257404357b1..d0148f10dfc0a 100644 --- a/drivers/gpu/drm/amd/display/dc/link/hwss/link_hwss_hpo_dp.c +++ b/drivers/gpu/drm/amd/display/dc/link/hwss/link_hwss_hpo_dp.c @@ -28,6 +28,8 @@ #include "dccg.h" #include "clk_mgr.h" +#define DC_LOGGER link->ctx->logger + void set_hpo_dp_throttled_vcp_size(struct pipe_ctx *pipe_ctx, struct fixed31_32 throttled_vcp_size) { @@ -124,6 +126,11 @@ void disable_hpo_dp_link_output(struct dc_link *link, const struct link_resource *link_res, enum signal_type signal) { + if (!link_res->hpo_dp_link_enc) { + DC_LOG_ERROR("%s: invalid hpo_dp_link_enc\n", __func__); + return; + } + link_res->hpo_dp_link_enc->funcs->link_disable(link_res->hpo_dp_link_enc); link_res->hpo_dp_link_enc->funcs->disable_link_phy( link_res->hpo_dp_link_enc, signal); -- 2.43.0