From: jsg Date: Mon, 9 Sep 2024 08:54:26 +0000 (+0000) Subject: drm/amd/display: Fix Coverity INTERGER_OVERFLOW within construct_integrated_info X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=777bfb8a6e3527904a896b86f659da0272a97f72;p=openbsd drm/amd/display: Fix Coverity INTERGER_OVERFLOW within construct_integrated_info From Hersen Wu 13faa9d401a5aa7a3b5211adb8ba0e9dddecaabb in linux-6.6.y/6.6.50 176abbcc71952e23009a6ed194fd203b99646884 in mainline linux --- diff --git a/sys/dev/pci/drm/amd/display/dc/bios/bios_parser.c b/sys/dev/pci/drm/amd/display/dc/bios/bios_parser.c index 6b319044758..19cd1bd844d 100644 --- a/sys/dev/pci/drm/amd/display/dc/bios/bios_parser.c +++ b/sys/dev/pci/drm/amd/display/dc/bios/bios_parser.c @@ -2552,8 +2552,8 @@ static enum bp_result construct_integrated_info( /* Sort voltage table from low to high*/ if (result == BP_RESULT_OK) { - uint32_t i; - uint32_t j; + int32_t i; + int32_t j; for (i = 1; i < NUMBER_OF_DISP_CLK_VOLTAGE; ++i) { for (j = i; j > 0; --j) { diff --git a/sys/dev/pci/drm/amd/display/dc/bios/bios_parser2.c b/sys/dev/pci/drm/amd/display/dc/bios/bios_parser2.c index 93720cf069d..384ddb28e6f 100644 --- a/sys/dev/pci/drm/amd/display/dc/bios/bios_parser2.c +++ b/sys/dev/pci/drm/amd/display/dc/bios/bios_parser2.c @@ -2935,8 +2935,11 @@ static enum bp_result construct_integrated_info( struct atom_common_table_header *header; struct atom_data_revision revision; - uint32_t i; - uint32_t j; + int32_t i; + int32_t j; + + if (!info) + return result; if (info && DATA_TABLES(integratedsysteminfo)) { header = GET_IMAGE(struct atom_common_table_header,