]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
drm/amd/display: Fix Coverity INTERGER_OVERFLOW within construct_integrated_info
authorHersen Wu <hersenxs.wu@amd.com>
Fri, 26 Apr 2024 14:46:41 +0000 (10:46 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 2 May 2024 20:18:17 +0000 (16:18 -0400)
[Why]
For substrcation, coverity reports integer overflow
warning message when variable type is uint32_t.

[How]
Change varaible type to int32_t.

Reviewed-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: Hersen Wu <hersenxs.wu@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c

index bc16db69a6636bc347db4fc6c29164cfa1bbf717..25fe1a124029845475c1a1243801e56936bff6cf 100644 (file)
@@ -2551,8 +2551,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) {
index 4d7006fdf3453d9c6f550f4570a6292ab19270b3..0d8498ab9b235e57a17b79d03d828b96e063b5d2 100644 (file)
@@ -3003,8 +3003,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,