Skip to content

Commit 282864c

Browse files
committed
drm/panthor: Fix access to uninitialized variable in tick_ctx_cleanup()
The group variable can't be used to retrieve ptdev in our second loop, because it points to the previously iterated list_head, not a valid group. Get the ptdev object from the scheduler instead. Cc: <[email protected]> Fixes: d72f049 ("drm/panthor: Allow driver compilation") Reported-by: kernel test robot <[email protected]> Reported-by: Julia Lawall <[email protected]> Closes: https://lore.kernel.org/r/[email protected]/ Signed-off-by: Boris Brezillon <[email protected]> Reviewed-by: Liviu Dudau <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent fa998a9 commit 282864c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/gpu/drm/panthor/panthor_sched.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2046,6 +2046,7 @@ static void
20462046
tick_ctx_cleanup(struct panthor_scheduler *sched,
20472047
struct panthor_sched_tick_ctx *ctx)
20482048
{
2049+
struct panthor_device *ptdev = sched->ptdev;
20492050
struct panthor_group *group, *tmp;
20502051
u32 i;
20512052

@@ -2054,7 +2055,7 @@ tick_ctx_cleanup(struct panthor_scheduler *sched,
20542055
/* If everything went fine, we should only have groups
20552056
* to be terminated in the old_groups lists.
20562057
*/
2057-
drm_WARN_ON(&group->ptdev->base, !ctx->csg_upd_failed_mask &&
2058+
drm_WARN_ON(&ptdev->base, !ctx->csg_upd_failed_mask &&
20582059
group_can_run(group));
20592060

20602061
if (!group_can_run(group)) {
@@ -2077,7 +2078,7 @@ tick_ctx_cleanup(struct panthor_scheduler *sched,
20772078
/* If everything went fine, the groups to schedule lists should
20782079
* be empty.
20792080
*/
2080-
drm_WARN_ON(&group->ptdev->base,
2081+
drm_WARN_ON(&ptdev->base,
20812082
!ctx->csg_upd_failed_mask && !list_empty(&ctx->groups[i]));
20822083

20832084
list_for_each_entry_safe(group, tmp, &ctx->groups[i], run_node) {

0 commit comments

Comments
 (0)