]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
fbdev: mmp: Constify struct mmp_overlay_ops
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Mon, 24 Jun 2024 19:59:42 +0000 (21:59 +0200)
committerHelge Deller <deller@gmx.de>
Tue, 25 Jun 2024 12:40:01 +0000 (14:40 +0200)
'struct mmp_overlay_ops' is not modified in this driver.

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

On a x86_64, with allmodconfig, as an example:
Before:
======
   text    data     bss     dec     hex filename
  11798     555      16   12369    3051 drivers/video/fbdev/mmp/hw/mmp_ctrl.o

After:
=====
   text    data     bss     dec     hex filename
  11834     507      16   12357    3045 drivers/video/fbdev/mmp/hw/mmp_ctrl.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Helge Deller <deller@gmx.de>
drivers/video/fbdev/mmp/hw/mmp_ctrl.c
include/video/mmp_disp.h

index 76b50b6c98ad9af154801bf7c07d9e1891d7370d..a20a2c4081274f7d5b6a76d0ffda39bc1cc4f03e 100644 (file)
@@ -313,7 +313,7 @@ static void path_set_mode(struct mmp_path *path, struct mmp_mode *mode)
        mutex_unlock(&path->access_ok);
 }
 
-static struct mmp_overlay_ops mmphw_overlay_ops = {
+static const struct mmp_overlay_ops mmphw_overlay_ops = {
        .set_fetch = overlay_set_fetch,
        .set_onoff = overlay_set_onoff,
        .set_win = overlay_set_win,
index a722dcbf5073dab3400918fd8052a146855eb6d7..41354bd49895728f48db8551f6ca4c8d33aba859 100644 (file)
@@ -156,7 +156,7 @@ struct mmp_overlay {
        int status;
        struct mutex access_ok;
 
-       struct mmp_overlay_ops *ops;
+       const struct mmp_overlay_ops *ops;
 };
 
 /* panel type */
@@ -299,7 +299,7 @@ struct mmp_path_info {
        int overlay_num;
        void (*set_mode)(struct mmp_path *path, struct mmp_mode *mode);
        void (*set_onoff)(struct mmp_path *path, int status);
-       struct mmp_overlay_ops *overlay_ops;
+       const struct mmp_overlay_ops *overlay_ops;
        void *plat_data;
 };