AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] drm/amd/display: Add dcn3.01 support to DC (v2)
@ 2022-07-26 15:19 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2022-07-26 15:19 UTC (permalink / raw)
  To: Roman.Li; +Cc: amd-gfx

[ It's not clear to me why Smatch is complaining about 2 year old code
  but that seems like the buggy commit? ]

Hello Roman Li,

The patch 3a83e4e64bb1: "drm/amd/display: Add dcn3.01 support to DC
(v2)" from Sep 29, 2020, leads to the following Smatch static checker
warning:

	drivers/gpu/drm/amd/amdgpu/../display/dc/clk_mgr/dcn301/vg_clk_mgr.c:539 find_dcfclk_for_voltage()
	error: buffer overflow 'clock_table->DcfClocks' 7 <= 7

drivers/gpu/drm/amd/amdgpu/../display/dc/clk_mgr/dcn301/vg_clk_mgr.c
    532 static unsigned int find_dcfclk_for_voltage(const struct vg_dpm_clocks *clock_table,
    533                 unsigned int voltage)
    534 {
    535         int i;
    536 
    537         for (i = 0; i < VG_NUM_SOC_VOLTAGE_LEVELS; i++) {
    538                 if (clock_table->SocVoltage[i] == voltage)
--> 539                         return clock_table->DcfClocks[i];
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^
The ->SocVoltage[] array has 8 elements but the ->DcfClocks[] array
only has 7 and the mismatch leads to an out of bounds.

    540         }
    541 
    542         ASSERT(0);
    543         return 0;
    544 }

regards,
dan carpenter

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-07-26 15:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-26 15:19 [bug report] drm/amd/display: Add dcn3.01 support to DC (v2) Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox