Unverified Commit b931a976 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!11866 v2 drm/amd/display: Ensure index calculation will not overflow

parents cb7f2945 6986ea9c
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -1498,10 +1498,9 @@ void dcn_bw_update_from_pplib(struct dc *dc)
		ASSERT(fclks.num_levels);

		vmin0p65_idx = 0;
		vmid0p72_idx = fclks.num_levels -
			(fclks.num_levels > 2 ? 3 : (fclks.num_levels > 1 ? 2 : 1));
		vnom0p8_idx = fclks.num_levels - (fclks.num_levels > 1 ? 2 : 1);
		vmax0p9_idx = fclks.num_levels - 1;
		vmid0p72_idx = fclks.num_levels > 2 ? fclks.num_levels - 3 : 0;
		vnom0p8_idx = fclks.num_levels > 1 ? fclks.num_levels - 2 : 0;
		vmax0p9_idx = fclks.num_levels > 0 ? fclks.num_levels - 1 : 0;

		dc->dcn_soc->fabric_and_dram_bandwidth_vmin0p65 =
			32 * (fclks.data[vmin0p65_idx].clocks_in_khz / 1000.0) / 1000.0;