From: Matthew Auld Date: Mon, 12 Aug 2024 14:13:32 +0000 (+0100) Subject: drm/xe: fix engine_class bounds check again X-Git-Tag: microblaze-v6.13~18^2~19^2~69 X-Git-Url: http://git.monstr.eu/?a=commitdiff_plain;h=23ab1cb6591dba7c97b65eb407cd71147bd878b8;p=linux-2.6-microblaze.git drm/xe: fix engine_class bounds check again This was fixed in commit b7dce525c4fc ("drm/xe/queue: fix engine_class bounds check"), but then re-introduced in commit 6f20fc09936e ("drm/xe: Move and export xe_hw_engine lookup.") which should only be simple code movement of the existing function. Fixes: 6f20fc09936e ("drm/xe: Move and export xe_hw_engine lookup.") Signed-off-by: Matthew Auld Cc: Dominik Grzegorzek Cc: Mika Kuoppala Cc: Matthew Brost Reviewed-by: Jonathan Cavitt Reviewed-by: Lucas De Marchi Link: https://patchwork.freedesktop.org/patch/msgid/20240812141331.729843-2-matthew.auld@intel.com Signed-off-by: Lucas De Marchi --- diff --git a/drivers/gpu/drm/xe/xe_hw_engine.c b/drivers/gpu/drm/xe/xe_hw_engine.c index 402dfa748e16..e195022ca836 100644 --- a/drivers/gpu/drm/xe/xe_hw_engine.c +++ b/drivers/gpu/drm/xe/xe_hw_engine.c @@ -1189,7 +1189,7 @@ xe_hw_engine_lookup(struct xe_device *xe, { unsigned int idx; - if (eci.engine_class > ARRAY_SIZE(user_to_xe_engine_class)) + if (eci.engine_class >= ARRAY_SIZE(user_to_xe_engine_class)) return NULL; if (eci.gt_id >= xe->info.gt_count)