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 7FA43154BFF; Thu, 5 Sep 2024 09:47:09 +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=1725529629; cv=none; b=iSCncDINlTEt5kKbn0J3eLGXXx+rS70wAT/WQLy1QrPuv/WrgYDHjU+jDHh0FhsjkD49K8vfwbM3+vb95E8D6ge0H2Tt/SLJk6vYqUuDs3tcboqScGnQ+htvlExdSrpPEBLz1Rq9OM7pOro9nNrRrzskMdmLOaiMFY228v95mak= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725529629; c=relaxed/simple; bh=PehB9plzPEwoFfR0nuiNBuwAa1+VBEniruiYJuenEEY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Qqtk2+Phr4IVQbrIlH7jtKxmL/SmUEsEKRhzlxDCU0z5LMFgPtVzHPzSNS7Rjws0xUvJo7pilldpXlHc1Oua9WK7OtV44yJsz8UVeERLp0AuHG12DSHGTc7qloQiQHVGCenppI9/0YIeBLKZLIEnuPsDCwFTu7LKLL39PYpSBpM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ta2WDniA; 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="ta2WDniA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E502BC4CEC6; Thu, 5 Sep 2024 09:47:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1725529629; bh=PehB9plzPEwoFfR0nuiNBuwAa1+VBEniruiYJuenEEY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ta2WDniABb2qpPOgyZNs3iL7CzswhZKTfZKf97IhQRFNDwk5Q00MJKbNtU/1XPj5t cSJwCzHVqZJA3EN8lJLqSdy6tlpT5E6WkLu7oaXCyYzBC6rMtInBOxQvCZJxd/PPmE mqqmvk1gXZ5pfWkxHf63FS6x6bbo1gM5EfKXdAOY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Rodrigo Siqueira , Tom Chung , Alex Hung , Daniel Wheeler , Alex Deucher , Sasha Levin Subject: [PATCH 6.10 062/184] drm/amd/display: Check index for aux_rd_interval before using Date: Thu, 5 Sep 2024 11:39:35 +0200 Message-ID: <20240905093734.660016182@linuxfoundation.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240905093732.239411633@linuxfoundation.org> References: <20240905093732.239411633@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alex Hung [ Upstream commit 9ba2ea6337b4f159aecb177555a6a81da92d302e ] aux_rd_interval has size of 7 and should be checked. This fixes 3 OVERRUN and 1 INTEGER_OVERFLOW issues reported by Coverity. Reviewed-by: Rodrigo Siqueira Acked-by: Tom Chung 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/protocols/link_dp_training.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.c b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.c index 1818970b8eaf..b8e704dbe956 100644 --- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.c +++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.c @@ -914,10 +914,10 @@ static enum dc_status configure_lttpr_mode_non_transparent( /* Driver does not need to train the first hop. Skip DPCD read and clear * AUX_RD_INTERVAL for DPTX-to-DPIA hop. */ - if (link->ep_type == DISPLAY_ENDPOINT_USB4_DPIA) + if (link->ep_type == DISPLAY_ENDPOINT_USB4_DPIA && repeater_cnt > 0 && repeater_cnt < MAX_REPEATER_CNT) link->dpcd_caps.lttpr_caps.aux_rd_interval[--repeater_cnt] = 0; - for (repeater_id = repeater_cnt; repeater_id > 0; repeater_id--) { + for (repeater_id = repeater_cnt; repeater_id > 0 && repeater_id < MAX_REPEATER_CNT; repeater_id--) { aux_interval_address = DP_TRAINING_AUX_RD_INTERVAL_PHY_REPEATER1 + ((DP_REPEATER_CONFIGURATION_AND_STATUS_SIZE) * (repeater_id - 1)); core_link_read_dpcd( -- 2.43.0