Coverity: jpeg_v4_0_5_start(): Code maintainability issues

2024-02-13 Thread coverity-bot
Hello!

This is an experimental semi-automated report about issues detected by
Coverity from a scan of next-20240213 as part of the linux-next scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan

You're getting this email because you were associated with the identified
lines of code (noted below) that were touched by commits:

  Mon Feb 12 16:09:32 2024 -0500
0a119d53f74a ("drm/amdgpu/jpeg: add support for jpeg DPG mode")

Coverity reported the following:

*** CID 1583635:  Code maintainability issues  (UNUSED_VALUE)
drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_5.c:461 in jpeg_v4_0_5_start()
455
456 WREG32_SOC15(VCN, i, regVCN_JPEG_DB_CTRL,
457 ring->doorbell_index << 
VCN_JPEG_DB_CTRL__OFFSET__SHIFT |
458 VCN_JPEG_DB_CTRL__EN_MASK);
459
460 if (adev->pg_flags & AMD_PG_SUPPORT_JPEG_DPG) {
vvv CID 1583635:  Code maintainability issues  (UNUSED_VALUE)
vvv Assigning value from "jpeg_v4_0_5_start_dpg_mode(adev, i, 
adev->jpeg.indirect_sram)" to "r" here, but that stored value is overwritten 
before it can be used.
461 r = jpeg_v4_0_5_start_dpg_mode(adev, i, 
adev->jpeg.indirect_sram);
462 continue;
463 }
464
465 /* disable power gating */
466 r = jpeg_v4_0_5_disable_static_power_gating(adev, i);

If this is a false positive, please let us know so we can mark it as
such, or teach the Coverity rules to be smarter. If not, please make
sure fixes get into linux-next. :) For patches fixing this, please
include these lines (but double-check the "Fixes" first):

Reported-by: coverity-bot 
Addresses-Coverity-ID: 1583635 ("Code maintainability issues")
Fixes: 0a119d53f74a ("drm/amdgpu/jpeg: add support for jpeg DPG mode")

Thanks for your attention!

-- 
Coverity-bot



Coverity: dm_dmub_sw_init(): Incorrect expression

2023-01-12 Thread coverity-bot
Hello!

This is an experimental semi-automated report about issues detected by
Coverity from a scan of next-20230111 as part of the linux-next scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan

You're getting this email because you were associated with the identified
lines of code (noted below) that were touched by commits:

  Tue Jan 10 14:32:57 2023 -0500
a7ab345149b8 ("drm/amd/display: Load DMUB microcode during early_init")

Coverity reported the following:

*** CID 1530544:  Incorrect expression  (IDENTICAL_BRANCHES)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c:1951 in dm_dmub_sw_init()
1945
1946switch (adev->ip_versions[DCE_HWIP][0]) {
1947case IP_VERSION(2, 1, 0):
1948dmub_asic = DMUB_ASIC_DCN21;
1949break;
1950case IP_VERSION(3, 0, 0):
vvv CID 1530544:  Incorrect expression  (IDENTICAL_BRANCHES)
vvv The same code is executed regardless of whether 
"adev->ip_versions[GC_HWIP][0] == 656128U" is true, because the 'then' and 
'else' branches are identical. Should one of the branches be modified, or the 
entire 'if' statement replaced?
1951if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(10, 3, 
0))
1952dmub_asic = DMUB_ASIC_DCN30;
1953else
1954dmub_asic = DMUB_ASIC_DCN30;
1955break;
1956case IP_VERSION(3, 0, 1):

If this is a false positive, please let us know so we can mark it as
such, or teach the Coverity rules to be smarter. If not, please make
sure fixes get into linux-next. :) For patches fixing this, please
include these lines (but double-check the "Fixes" first):

Reported-by: coverity-bot 
Addresses-Coverity-ID: 1530544 ("Incorrect expression")
Fixes: a7ab345149b8 ("drm/amd/display: Load DMUB microcode during early_init")

Thanks for your attention!

-- 
Coverity-bot


Coverity: gfx_v9_0_init_cp_compute_microcode(): Control flow issues

2023-01-12 Thread coverity-bot
Hello!

This is an experimental semi-automated report about issues detected by
Coverity from a scan of next-20230111 as part of the linux-next scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan

You're getting this email because you were associated with the identified
lines of code (noted below) that were touched by commits:

  Mon Jan 9 17:02:18 2023 -0500
ec787deb2ddf ("drm/amd: Use `amdgpu_ucode_*` helpers for GFX9")

Coverity reported the following:

*** CID 1530548:  Control flow issues  (DEADCODE)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:1374 in 
gfx_v9_0_init_cp_compute_microcode()
1368adev->gfx.mec2_feature_version = 
adev->gfx.mec_feature_version;
1369}
1370
1371gfx_v9_0_check_if_need_gfxoff(adev);
1372gfx_v9_0_check_fw_write_wait(adev);
1373if (err) {
vvv CID 1530548:  Control flow issues  (DEADCODE)
vvv Execution cannot reach this statement: "amdgpu_ucode_release(".
1374amdgpu_ucode_release(>gfx.mec_fw);
1375amdgpu_ucode_release(>gfx.mec2_fw);
1376}
1377return err;
1378 }
1379

If this is a false positive, please let us know so we can mark it as
such, or teach the Coverity rules to be smarter. If not, please make
sure fixes get into linux-next. :) For patches fixing this, please
include these lines (but double-check the "Fixes" first):

Reported-by: coverity-bot 
Addresses-Coverity-ID: 1530548 ("Control flow issues")
Fixes: ec787deb2ddf ("drm/amd: Use `amdgpu_ucode_*` helpers for GFX9")

Thanks for your attention!

-- 
Coverity-bot


Coverity: pre_compute_mst_dsc_configs_for_state(): Uninitialized variables

2022-11-18 Thread coverity-bot
Hello!

This is an experimental semi-automated report about issues detected by
Coverity from a scan of next-20221118 as part of the linux-next scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan

You're getting this email because you were associated with the identified
lines of code (noted below) that were touched by commits:

  Thu Nov 17 00:18:25 2022 -0500
7cce4cd628be ("drm/amdgpu/mst: Stop ignoring error codes and deadlocking")

Coverity reported the following:

*** CID 1527373:  Uninitialized variables  (UNINIT)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c:1227 in 
pre_compute_mst_dsc_configs_for_state()
1221for (j = 0; j < dc_state->stream_count; j++) {
1222if (dc_state->streams[j]->link == stream->link)
1223computed_streams[j] = true;
1224}
1225}
1226
vvv CID 1527373:  Uninitialized variables  (UNINIT)
vvv Using uninitialized value "ret".
1227return ret;
1228 }
1229
1230 static int find_crtc_index_in_state_by_stream(struct drm_atomic_state 
*state,
1231  struct dc_stream_state 
*stream)
1232 {

If this is a false positive, please let us know so we can mark it as
such, or teach the Coverity rules to be smarter. If not, please make
sure fixes get into linux-next. :) For patches fixing this, please
include these lines (but double-check the "Fixes" first):

Reported-by: coverity-bot 
Addresses-Coverity-ID: 1527373 ("Uninitialized variables")
Fixes: 7cce4cd628be ("drm/amdgpu/mst: Stop ignoring error codes and 
deadlocking")

If dc_state->stream_count is 0, "ret" is undefined. Perhaps initialize
it as -EINVAL?

Thanks for your attention!

-- 
Coverity-bot


Coverity: kfd_parse_subtype_cache(): Memory - corruptions

2022-11-04 Thread coverity-bot
Hello!

This is an experimental semi-automated report about issues detected by
Coverity from a scan of next-20221104 as part of the linux-next scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan

You're getting this email because you were associated with the identified
lines of code (noted below) that were touched by commits:

  Fri Dec 8 23:08:59 2017 -0500
3a87177eb141 ("drm/amdkfd: Add topology support for dGPUs")

Coverity reported the following:

*** CID 1527133:  Memory - corruptions  (OVERRUN)
drivers/gpu/drm/amd/amdkfd/kfd_crat.c:1113 in kfd_parse_subtype_cache()
1107props->cache_size = cache->cache_size;
1108props->cacheline_size = cache->cache_line_size;
1109props->cachelines_per_tag = 
cache->lines_per_tag;
1110props->cache_assoc = cache->associativity;
props->cache_latency = cache->cache_latency;
1112
vvv CID 1527133:  Memory - corruptions  (OVERRUN)
vvv Overrunning array "cache->sibling_map" of 32 bytes by passing it to a 
function which accesses it at byte offset 63 using argument "64UL". [Note: The 
source code implementation of the function has been overridden by a builtin 
model.]
1113memcpy(props->sibling_map, cache->sibling_map,
1114sizeof(props->sibling_map));
1115
1116/* set the sibling_map_size as 32 for CRAT from 
ACPI */
1117props->sibling_map_size = CRAT_SIBLINGMAP_SIZE;
1118

If this is a false positive, please let us know so we can mark it as
such, or teach the Coverity rules to be smarter. If not, please make
sure fixes get into linux-next. :) For patches fixing this, please
include these lines (but double-check the "Fixes" first):

Reported-by: coverity-bot 
Addresses-Coverity-ID: 1527133 ("Memory - corruptions")
Fixes: 3a87177eb141 ("drm/amdkfd: Add topology support for dGPUs")

I'm not sure why this suddenly appeared after 5 years, but the read
over-run looks legit:

struct crat_subtype_cache {
...
uint8_t sibling_map[CRAT_SIBLINGMAP_SIZE];

#define CRAT_SIBLINGMAP_SIZE32


struct kfd_cache_properties {
...
uint8_t     sibling_map[CACHE_SIBLINGMAP_SIZE];

#define CACHE_SIBLINGMAP_SIZE 64

Thanks for your attention!

-- 
Coverity-bot