drm/amd/powerplay: Fix an off by one in navi10_get_smu_msg_index()
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 26 Aug 2019 13:20:12 +0000 (16:20 +0300)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 27 Aug 2019 13:16:08 +0000 (08:16 -0500)
The navi10_message_map[] array has SMU_MSG_MAX_COUNT elements so the ">"
has to be changed to ">=" to prevent reading one element beyond the end
of the array.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/powerplay/navi10_ppt.c

index 6f96ed7b97756c46ce0c2ae5a2a5006e515bde2d..9f738c6422682c9d6b74a326133973670cb1baa1 100644 (file)
@@ -213,7 +213,7 @@ static int navi10_get_smu_msg_index(struct smu_context *smc, uint32_t index)
 {
        struct smu_11_0_cmn2aisc_mapping mapping;
 
-       if (index > SMU_MSG_MAX_COUNT)
+       if (index >= SMU_MSG_MAX_COUNT)
                return -EINVAL;
 
        mapping = navi10_message_map[index];