]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/amd/powerplay: Off by one in vega20_get_smu_msg_index()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 21 Mar 2019 09:19:57 +0000 (12:19 +0300)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 21 Mar 2019 19:05:26 +0000 (14:05 -0500)
The > should be >= so that we don't read one element beyond the end of
the vega20_message_map[] array.

Fixes: 78031c2c4dcd ("drm/amd/powerplay: implement smu vega20_message_map for vega20")
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/powerplay/vega20_ppt.c

index 41e6f49c9cb6e8127ff4fb73f32ffe233dff8f64..8fafcbdb1dfdf5656157db45d4409c35922c1bdd 100644 (file)
@@ -132,7 +132,8 @@ static int vega20_message_map[SMU_MSG_MAX_COUNT] = {
 static int vega20_get_smu_msg_index(struct smu_context *smc, uint32_t index)
 {
        int val;
-       if (index > SMU_MSG_MAX_COUNT)
+
+       if (index >= SMU_MSG_MAX_COUNT)
                return -EINVAL;
 
        val = vega20_message_map[index];