dcn321_fpu.c:626: Array index check in wrong place ?

David Binderman dcb314 at hotmail.com
Mon Nov 7 08:20:24 UTC 2022


Hello there,

Static analyser cppcheck says:

linux-6.1-rc4/drivers/gpu/drm/amd/display/dc/dml/dcn321/dcn321_fpu.c:626:27: style: Array index 'i' is used before limits check. [arrayIndexThenCheck]

Source code is

               if (dcfclk_sta_targets[i] < optimal_dcfclk_for_uclk[j] && i < num_dcfclk_sta_targets) {

It might be wise to move the limits check to before use.

Regards

David Binderman

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20221107/2836101d/attachment-0001.htm>


More information about the dri-devel mailing list