Skip to contentSkip to conversation

drm/amd/display: Introduce DML2

DISCUSSION Colin King (gmail) 2 participants 2 messages Oct 10, 2024

lore
Share & tools
lore
#0 lore raw

Hi,

Static analysis on linux-next has found a potential issue in function dml_rq_dlg_get_rq_reg in drivers/gpu/drm/amd/display/dc/dml2/dml_display_rq_dlg_calc.c

The issue is as follows:

        if (min_meta_chunk_bytes == 0)
                rq_regs->rq_regs_l.min_meta_chunk_size = 0;
        else
                rq_regs->rq_regs_l.min_meta_chunk_size = 

(dml_uint_t)(dml_log2((dml_float_t) min_meta_chunk_bytes) - 6 + 1);

        if ( == 0)
                rq_regs->rq_regs_c.min_meta_chunk_size = 0;
        else
                rq_regs->rq_regs_c.min_meta_chunk_size = 

(dml_uint_t)(dml_log2((dml_float_t) p1_min_meta_chunk_bytes) - 6 + 1);

it appears that the second if statement is checking for min_meta_chunk_bytes == 0 and I think it should be in fact checking for p1_min_meta_chunk_bytes == 0 instead. I don't have the hardware so I can't test this hypothesis.

Regards,

Colin

#1 lore raw

[Public]

Hi Colin,

It's not critical since before the check:
p1_min_meta_chunk_bytes = min_meta_chunk_bytes;

Thanks,
Roman

Quoted 37 lines

-----Original Message-----
From: Colin King (gmail) <[email protected]>
Sent: Thursday, October 10, 2024 11:59 AM
To: Zhuo, Lillian <[email protected]>
Cc: Siqueira, Rodrigo <[email protected]>; Li, Roman <[email protected]>; Deucher, Alexander <[email protected]>; [email protected]; amd-gfx mailing list <amd- [email protected]>; amd-gfx mailing list <[email protected]>
Subject: re: drm/amd/display: Introduce DML2

Hi,

Static analysis on linux-next has found a potential issue in function dml_rq_dlg_get_rq_reg in drivers/gpu/drm/amd/display/dc/dml2/dml_display_rq_dlg_calc.c

The issue is as follows:

         if (min_meta_chunk_bytes == 0)
                 rq_regs->rq_regs_l.min_meta_chunk_size = 0;
         else
                 rq_regs->rq_regs_l.min_meta_chunk_size =

(dml_uint_t)(dml_log2((dml_float_t) min_meta_chunk_bytes) - 6 + 1);

         if ( == 0)
                 rq_regs->rq_regs_c.min_meta_chunk_size = 0;
         else
                 rq_regs->rq_regs_c.min_meta_chunk_size =

(dml_uint_t)(dml_log2((dml_float_t) p1_min_meta_chunk_bytes) - 6 + 1);

it appears that the second if statement is checking for min_meta_chunk_bytes == 0 and I think it should be in fact checking for p1_min_meta_chunk_bytes == 0 instead. I don't have the hardware so I can't test this hypothesis.

Regards,

Colin