drm/amd/display: Fix unsigned variable compared to less than zero
Subsystems (3)
PATCH 1/1 drm/amd/display: Fix unsigned variable compared to less than zero
Currenly, the error check below on variable *vcpi_slots* is always false because it is a uint64_t type variable, hence, the values this variable can hold are never less than zero:
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c:
4870 if (dm_new_connector_state->vcpi_slots < 0) {
4871 DRM_DEBUG_ATOMIC("failed finding vcpi slots: %d\n", (int)dm_new_connector_stat e->vcpi_slots);
4872 return dm_new_connector_state->vcpi_slots;
4873 }
Fix this by making *vcpi_slots* of int type.
Addresses-Coverity: 1487838 ("Unsigned compared against 0")
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +1 -1
@@ -403,7 +403,7 @@ struct dm_connector_state {bool underscan_enable;bool freesync_capable;uint8_t abm_level; -uint64_t vcpi_slots; +int vcpi_slots;uint64_t pbn; };
Signature · 6 lines
2.23.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Thanks for catching it!
Quoted 33 lines · Gustavo A. R. Silva
Currenly, the error check below on variable*vcpi_slots* is always false because it is a
uint64_ttype variable, hence, the values this variable can hold are never less than zero:
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c:
4870 if (dm_new_connector_state->vcpi_slots< 0) {
4871DRM_DEBUG_ATOMIC("failed finding vcpi slots: %d\n", (int)dm_new_connector_stat e->vcpi_slots);
4872 returndm_new_connector_state->vcpi_slots;
4873 }Fix this by making*vcpi_slots* of int type
Addresses-Coverity: 1487838 ("Unsigned compared against 0")
Fixes b4c578f08378 ("drm/amd/display: Add MST atomic routines")Signed-off-by Gustavo A. R. Silva<[email protected]>--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +1
-2@@ -403,7 +403,7 @@ struct dm_connector_state {bool underscan_enable;bool freesync_capable;uint8_t abm_level; -uint64_t vcpi_slots; +int vcpi_slots;uint64_t pbn; }; -- 2.23.0
Signature · 8 lines
Thanks, Mikita Lipski Software Engineer, AMD [email protected] _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 3 lines · Mikita Lipski
Thanks for catching it!
Glad to help out. :)
Quoted 2 lines
Reviewed-by Mikita Lipski <[email protected]>
Thanks
--
Gustavo
Quoted 35 lines · Gustavo A. R. Silva
Quoted 32 lines
Currenly, the error check below on variable*vcpi_slots* is always false because it is a
uint64_ttype variable, hence, the values this variable can hold are never less than zero:
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c:
4870 if (dm_new_connector_state->vcpi_slots< 0) {
4871DRM_DEBUG_ATOMIC("failed finding vcpi slots: %d\n", (int)dm_new_connector_stat e->vcpi_slots); 4872 returndm_new_connector_state->vcpi_slots;
4873 }Fix this by making*vcpi_slots* of int type
Addresses-Coverity: 1487838 ("Unsigned compared against 0")
Fixes b4c578f08378 ("drm/amd/display: Add MST atomic routines")Signed-off-by Gustavo A. R. Silva<[email protected]>---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +1
-1@@ -403,7 +403,7 @@ struct dm_connector_state { bool underscan_enable; bool freesync_capable; uint8_t abm_level; - uint64_t vcpi_slots; + int vcpi_slots; uint64_t pbn; };-- 2.23.0
Alex Deucher
AppliedApplied. Thanks!
Alex
Quoted 56 lines · Gustavo A. R. Silva
Quoted 3 lines · Mikita Lipski
Thanks for catching it!
Glad to help out. :)
Quoted 2 lines
Reviewed-by Mikita Lipski <[email protected]>Thanks
--
GustavoQuoted 21 lines · Gustavo A. R. Silva
Quoted 19 lines
Currenly, the error check below on variable*vcpi_slots* is always false because it is a
uint64_ttype variable, hence, the values this variable can hold are never less than zero:
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c:
4870 if (dm_new_connector_state->vcpi_slots< 0) {
4871DRM_DEBUG_ATOMIC("failed finding vcpi slots: %d\n", (int)dm_new_connector_stat e->vcpi_slots);
4872 returndm_new_connector_state->vcpi_slots;
4873 }Fix this by making*vcpi_slots* of int type
Addresses-Coverity: 1487838 ("Unsigned compared against 0")
Fixes b4c578f08378 ("drm/amd/display: Add MST atomic routines")Signed-off-by Gustavo A. R. Silva<[email protected]>--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 14 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h struct dm_connector_state { · line 409
Quoted 13 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +1
-1@@ -403,7 +403,7 @@ struct dm_connector_state {bool underscan_enable;bool freesync_capable;uint8_t abm_level; -uint64_t vcpi_slots; +int vcpi_slots;uint64_t pbn; }; -- 2.23.0_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx