Hi Jani,

> On Thu, 06 Nov 2025, Krzysztof Karas <[email protected]> wrote:
> > There are two unsafe scenarios in that function:
> >  1) drm_format_info_block_width/height() may return 0 and cause
> > division by 0 down the line. Warn early if any of these values
> > are 0.
> >  2) dma_addr calculations are carried out using 32-bit
> > arithmetic, which could cause a truncation of the values
> > before they are extended to 64 bits. Cast one of the operands
> > to dma_addr_t, so 64-bit arithmetic is used.
> 
> Lists like this are an indication it should be multiple patches. The
> only thing in common here is the function.
Hmm, sure, I'll split this change.

> 
> >
> > Signed-off-by: Krzysztof Karas <[email protected]>
> > ---
> >
> > v4:
> > * use WARN_ON_ONCE() instead of returning early (Andi)
> 
> I don't get it. Why are we allowing the oops if we check it?
There is already an early return in this function due to missing
DMA GEM object, which looks like error path, so I proposed
"return 0" in v3. Andi suggested using WARN or BUG macro
here, to which you responded "Never BUG* though.".
Do we have any good alternatives to handle this?

[...]

-- 
Best Regards,
Krzysztof

Reply via email to