]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
drm/nouveau: Constify struct nouveau_job_ops
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Fri, 14 Jun 2024 16:08:30 +0000 (18:08 +0200)
committerDanilo Krummrich <dakr@redhat.com>
Mon, 17 Jun 2024 15:22:06 +0000 (17:22 +0200)
"struct nouveau_job_ops" is not modified in these drivers.

Constifying this structure moves some data to a read-only section, so
increase overall security.

In order to do it, "struct nouveau_job" and "struct nouveau_job_args" also
need to be adjusted to this new const qualifier.

On a x86_64, with allmodconfig:
Before:
======
   text    data     bss     dec     hex filename
   5570     152       0    5722    165a drivers/gpu/drm/nouveau/nouveau_exec.o

After:
=====
   text    data     bss     dec     hex filename
   5630     112       0    5742    166e drivers/gpu/drm/nouveau/nouveau_exec.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Danilo Krummrich <dakr@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/860e9753d7867aa46b003bb3d0497f1b04065b24.1718381285.git.christophe.jaillet@wanadoo.fr
drivers/gpu/drm/nouveau/nouveau_exec.c
drivers/gpu/drm/nouveau/nouveau_sched.h
drivers/gpu/drm/nouveau/nouveau_uvmm.c

index e65c0ef23bc73d59f3066ff02ae9360253b93e6d..a0b5f1b16e8b39a84e3e79429a532b10fbffd066 100644 (file)
@@ -188,7 +188,7 @@ nouveau_exec_job_timeout(struct nouveau_job *job)
        return DRM_GPU_SCHED_STAT_NOMINAL;
 }
 
-static struct nouveau_job_ops nouveau_exec_job_ops = {
+static const struct nouveau_job_ops nouveau_exec_job_ops = {
        .submit = nouveau_exec_job_submit,
        .armed_submit = nouveau_exec_job_armed_submit,
        .run = nouveau_exec_job_run,
index e1f01a23e6f6e84cf2700bde86e4fb5e3e013df1..20cd1da8db73c3c9b1e7365da2cd408a6e9de312 100644 (file)
@@ -42,7 +42,7 @@ struct nouveau_job_args {
                u32 count;
        } out_sync;
 
-       struct nouveau_job_ops *ops;
+       const struct nouveau_job_ops *ops;
 };
 
 struct nouveau_job {
@@ -73,7 +73,7 @@ struct nouveau_job {
                u32 count;
        } out_sync;
 
-       struct nouveau_job_ops {
+       const struct nouveau_job_ops {
                /* If .submit() returns without any error, it is guaranteed that
                 * armed_submit() is called.
                 */
index ee02cd833c5e4345abdc3fb83968769999ac4340..9402fa320a7e9d28380da59aef38127b284d696f 100644 (file)
@@ -1534,7 +1534,7 @@ nouveau_uvmm_bind_job_cleanup(struct nouveau_job *job)
        nouveau_uvmm_bind_job_put(bind_job);
 }
 
-static struct nouveau_job_ops nouveau_bind_job_ops = {
+static const struct nouveau_job_ops nouveau_bind_job_ops = {
        .submit = nouveau_uvmm_bind_job_submit,
        .armed_submit = nouveau_uvmm_bind_job_armed_submit,
        .run = nouveau_uvmm_bind_job_run,