linux/drivers/gpu/drm/scheduler
Philipp Stanner 87210234e5 drm/sched: memset() 'job' in drm_sched_job_init()
[ Upstream commit 2320c9e6a7 ]

drm_sched_job_init() has no control over how users allocate struct
drm_sched_job. Unfortunately, the function can also not set some struct
members such as job->sched.

This could theoretically lead to UB by users dereferencing the struct's
pointer members too early.

It is easier to debug such issues if these pointers are initialized to
NULL, so dereferencing them causes a NULL pointer exception.
Accordingly, drm_sched_entity_init() does precisely that and initializes
its struct with memset().

Initialize parameter "job" to 0 in drm_sched_job_init().

Signed-off-by: Philipp Stanner <pstanner@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241021105028.19794-2-pstanner@redhat.com
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2024-12-14 20:00:06 +01:00
..
gpu_scheduler_trace.h drm/sched: use __string in tracepoints 2022-04-26 15:11:00 -04:00
Makefile drm/scheduler: rename gpu_scheduler.c to sched_main.c 2018-08-27 11:10:44 -05:00
sched_entity.c drm/sched: Add locking to drm_sched_entity_modify_sched 2024-10-10 11:58:00 +02:00
sched_fence.c Linux 6.5-rc1 2023-07-11 09:23:20 +02:00
sched_main.c drm/sched: memset() 'job' in drm_sched_job_init() 2024-12-14 20:00:06 +01:00