Skip to content

Commit 070fda6

Browse files
sohaibndgregkh
authored andcommitted
drm/amd/display: fixed integer types and null check locations
commit 0484e05d048b66d01d1f3c1d2306010bb57d8738 upstream. [why]: issues fixed: - comparison with wider integer type in loop condition which can cause infinite loops - pointer dereference before null check Cc: Mario Limonciello <[email protected]> Cc: Alex Deucher <[email protected]> Cc: [email protected] Reviewed-by: Josip Pavic <[email protected]> Acked-by: Aurabindo Pillai <[email protected]> Signed-off-by: Sohaib Nadeem <[email protected]> Tested-by: Daniel Wheeler <[email protected]> Signed-off-by: Alex Deucher <[email protected]> [ delete changes made in drivers/gpu/drm/amd/display/dc/link/link_validation.c for this file is not present in linux-6.1.y ] Signed-off-by: Jianqi Ren <[email protected]> Signed-off-by: He Zhe <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent ee3ab05 commit 070fda6

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1862,19 +1862,21 @@ static enum bp_result get_firmware_info_v3_2(
18621862
/* Vega12 */
18631863
smu_info_v3_2 = GET_IMAGE(struct atom_smu_info_v3_2,
18641864
DATA_TABLES(smu_info));
1865-
DC_LOG_BIOS("gpuclk_ss_percentage (unit of 0.001 percent): %d\n", smu_info_v3_2->gpuclk_ss_percentage);
18661865
if (!smu_info_v3_2)
18671866
return BP_RESULT_BADBIOSTABLE;
18681867

1868+
DC_LOG_BIOS("gpuclk_ss_percentage (unit of 0.001 percent): %d\n", smu_info_v3_2->gpuclk_ss_percentage);
1869+
18691870
info->default_engine_clk = smu_info_v3_2->bootup_dcefclk_10khz * 10;
18701871
} else if (revision.minor == 3) {
18711872
/* Vega20 */
18721873
smu_info_v3_3 = GET_IMAGE(struct atom_smu_info_v3_3,
18731874
DATA_TABLES(smu_info));
1874-
DC_LOG_BIOS("gpuclk_ss_percentage (unit of 0.001 percent): %d\n", smu_info_v3_3->gpuclk_ss_percentage);
18751875
if (!smu_info_v3_3)
18761876
return BP_RESULT_BADBIOSTABLE;
18771877

1878+
DC_LOG_BIOS("gpuclk_ss_percentage (unit of 0.001 percent): %d\n", smu_info_v3_3->gpuclk_ss_percentage);
1879+
18781880
info->default_engine_clk = smu_info_v3_3->bootup_dcefclk_10khz * 10;
18791881
}
18801882

@@ -2439,10 +2441,11 @@ static enum bp_result get_integrated_info_v11(
24392441
info_v11 = GET_IMAGE(struct atom_integrated_system_info_v1_11,
24402442
DATA_TABLES(integratedsysteminfo));
24412443

2442-
DC_LOG_BIOS("gpuclk_ss_percentage (unit of 0.001 percent): %d\n", info_v11->gpuclk_ss_percentage);
24432444
if (info_v11 == NULL)
24442445
return BP_RESULT_BADBIOSTABLE;
24452446

2447+
DC_LOG_BIOS("gpuclk_ss_percentage (unit of 0.001 percent): %d\n", info_v11->gpuclk_ss_percentage);
2448+
24462449
info->gpu_cap_info =
24472450
le32_to_cpu(info_v11->gpucapinfo);
24482451
/*
@@ -2654,11 +2657,12 @@ static enum bp_result get_integrated_info_v2_1(
26542657

26552658
info_v2_1 = GET_IMAGE(struct atom_integrated_system_info_v2_1,
26562659
DATA_TABLES(integratedsysteminfo));
2657-
DC_LOG_BIOS("gpuclk_ss_percentage (unit of 0.001 percent): %d\n", info_v2_1->gpuclk_ss_percentage);
26582660

26592661
if (info_v2_1 == NULL)
26602662
return BP_RESULT_BADBIOSTABLE;
26612663

2664+
DC_LOG_BIOS("gpuclk_ss_percentage (unit of 0.001 percent): %d\n", info_v2_1->gpuclk_ss_percentage);
2665+
26622666
info->gpu_cap_info =
26632667
le32_to_cpu(info_v2_1->gpucapinfo);
26642668
/*
@@ -2816,11 +2820,11 @@ static enum bp_result get_integrated_info_v2_2(
28162820
info_v2_2 = GET_IMAGE(struct atom_integrated_system_info_v2_2,
28172821
DATA_TABLES(integratedsysteminfo));
28182822

2819-
DC_LOG_BIOS("gpuclk_ss_percentage (unit of 0.001 percent): %d\n", info_v2_2->gpuclk_ss_percentage);
2820-
28212823
if (info_v2_2 == NULL)
28222824
return BP_RESULT_BADBIOSTABLE;
28232825

2826+
DC_LOG_BIOS("gpuclk_ss_percentage (unit of 0.001 percent): %d\n", info_v2_2->gpuclk_ss_percentage);
2827+
28242828
info->gpu_cap_info =
28252829
le32_to_cpu(info_v2_2->gpucapinfo);
28262830
/*

0 commit comments

Comments
 (0)