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 CB47D1DED48; Tue, 8 Oct 2024 13:19:48 +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=1728393588; cv=none; b=elfHUm/x8UPhEJ5Ogb+UoZ3VwxuhP6J5o19bw00EOoMg+bdmvH15Dcr6sx+aW+V6Gkjs+81M6FILQHhOsxazV10dQiYpN12zuUpgbW0/EZhrK4qBrIj2nW1O45YwPhuufZC0ITWgQVGOkwad776ZXQwVejfZWTRPJLeHIp+KfS0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728393588; c=relaxed/simple; bh=z3tLvhULFQZQClYRwpeoMiQ27trAoJlYTRF8NhlCgvo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SWg66KAUYsdCApi+ZS8HL8Xcv87gjmT27kXCbb/+5zAlCtmoZIttXrmMVNWFP2bIwG/Wcr7lKK0jPe7zBfQrI9HNW9USbiJgv8EngjzMjp9GHlAEf5b4qLosTW4yZGJTTAVBh3WNqfg3FGi7Cvl+rg/IvJj3NnBSP9jIYn+YEEo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=pegTj0Aw; 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="pegTj0Aw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5286BC4CEC7; Tue, 8 Oct 2024 13:19:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1728393588; bh=z3tLvhULFQZQClYRwpeoMiQ27trAoJlYTRF8NhlCgvo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pegTj0AwEXNX3he/fDjEFdUsj7kT9PfjcgRIFuOrKLGVjk48wiD6BQVHA/gpM0hJ8 6jEqcUGGL0NJHJgCTcrMrd/xNMTFNTdK9GZXSv1Fiingmm0nfdnP4cF4emxPN7BQms /YTa7w9pFAwsqpXEvFmChms0Kr+pdL6Lv0S/SBZY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Rodrigo Siqueira , Jerry Zuo , Alex Hung , Daniel Wheeler , Alex Deucher , Sasha Levin Subject: [PATCH 6.6 155/386] drm/amd/display: Check link_res->hpo_dp_link_enc before using it Date: Tue, 8 Oct 2024 14:06:40 +0200 Message-ID: <20241008115635.526074545@linuxfoundation.org> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241008115629.309157387@linuxfoundation.org> References: <20241008115629.309157387@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ 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