[PATCH 1/3] drm/amdgpu: Fix the out-of-bounds read warning

Ma Jun Jun.Ma2 at amd.com
Mon Apr 22 09:49:06 UTC 2024


Use '<' instead of '<=' to fix the out-of-bounds
read error

Signed-off-by: Ma Jun <Jun.Ma2 at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c
index eb25af46622e..5c08ad234439 100644
--- a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c
@@ -144,7 +144,7 @@ static const char *mes_v11_0_get_misc_op_string(union MESAPI__MISC *x_pkt)
 	const char *op_str = NULL;
 
 	if ((x_pkt->header.opcode == MES_SCH_API_MISC) &&
-	    (x_pkt->opcode <= ARRAY_SIZE(mes_v11_0_misc_opcodes)))
+	    (x_pkt->opcode < ARRAY_SIZE(mes_v11_0_misc_opcodes)))
 		op_str = mes_v11_0_misc_opcodes[x_pkt->opcode];
 
 	return op_str;
-- 
2.34.1



More information about the amd-gfx mailing list