drm/sched: Fix bounds limiting when given a malformed entity
Subsystems (3)
PATCH 1/1 drm/sched: Fix bounds limiting when given a malformed entity
If we're given a malformed entity in drm_sched_entity_init()--shouldn't happen, but we verify--with out-of-bounds priority value, we set it to an allowed value. Fix the expression which sets this limit.
Signed-off-by Luben Tuikov <[email protected]>
Fixes 56e449603f0ac5 ("drm/sched: Convert the GPU scheduler to variable number of run-queues")
--- drivers/gpu/drm/scheduler/sched_entity.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/scheduler/sched_entity.c +6 -3
@@ -84,9 +84,12 @@ int drm_sched_entity_init(struct drm_sched_entity *entity,/* The "priority" of an entity cannot exceed the number * of run-queues of a scheduler. */ -if (entity->priority >= sched_list[0 ]->num_rqs) - entity->priority =max_t (u32, sched_list[0 ]->num_rqs, -DRM_SCHED_PRIORITY_MIN ); +if (entity->priority >= sched_list[0 ]->num_rqs) { +drm_err (sched_list[0 ],"entity with out-of-bounds priority:%u num_rqs:%u\n" , + entity->priority, sched_list[0 ]->num_rqs); + entity->priority =max_t (s32, (s32 ) sched_list[0 ]->num_rqs -1 , + (s32 )DRM_SCHED_PRIORITY_MIN ); + } entity->rq = sched_list[0 ]->sched_rq[entity->priority]; }
base-commit: b3c5a7de9aeb51cb19160f3f61343ed87487abde
Signature · 1 line
2.43.0