]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
fbdev: Constify struct sbus_mmap_map
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sun, 13 Oct 2024 11:48:01 +0000 (13:48 +0200)
committerHelge Deller <deller@gmx.de>
Tue, 15 Oct 2024 08:07:32 +0000 (10:07 +0200)
'struct sbus_mmap_map' are not modified in these drivers.

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

Update sbusfb_mmap_helper() accordingly.

On a x86_64, with allmodconfig, as an example:
Before:
======
   text    data     bss     dec     hex filename
   2452     536      16    3004     bbc drivers/video/fbdev/bw2.o

After:
=====
   text    data     bss     dec     hex filename
   2500     483      16    2999     bb7 drivers/video/fbdev/bw2.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Helge Deller <deller@gmx.de>
drivers/video/fbdev/bw2.c
drivers/video/fbdev/cg14.c
drivers/video/fbdev/cg3.c
drivers/video/fbdev/cg6.c
drivers/video/fbdev/ffb.c
drivers/video/fbdev/leo.c
drivers/video/fbdev/p9100.c
drivers/video/fbdev/sbuslib.c
drivers/video/fbdev/sbuslib.h
drivers/video/fbdev/tcx.c

index 4a64940e0c001c327de84c973d8b5232cf611f3b..e757462af0a61cf0ce911f339207a388cb3b5e65 100644 (file)
@@ -147,7 +147,7 @@ bw2_blank(int blank, struct fb_info *info)
        return 0;
 }
 
-static struct sbus_mmap_map bw2_mmap_map[] = {
+static const struct sbus_mmap_map bw2_mmap_map[] = {
        {
                .size = SBUS_MMAP_FBSIZE(1)
        },
index 430e1a7b352b27d08dd357a862e6259d98f4f9aa..5389f8f07346bd73807e70818afcce7d773e44fd 100644 (file)
@@ -360,7 +360,7 @@ static void cg14_init_fix(struct fb_info *info, int linebytes,
        info->fix.accel = FB_ACCEL_SUN_CG14;
 }
 
-static struct sbus_mmap_map __cg14_mmap_map[CG14_MMAP_ENTRIES] = {
+static const struct sbus_mmap_map __cg14_mmap_map[CG14_MMAP_ENTRIES] = {
        {
                .voff   = CG14_REGS,
                .poff   = 0x80000000,
index e4c53c6632ba07aed166b22c2a1e6f66ad6da7fb..a58a483014e6ae95c4b1bdd057f3974c9d7ea1a8 100644 (file)
@@ -209,7 +209,7 @@ static int cg3_blank(int blank, struct fb_info *info)
        return 0;
 }
 
-static struct sbus_mmap_map cg3_mmap_map[] = {
+static const struct sbus_mmap_map cg3_mmap_map[] = {
        {
                .voff   = CG3_MMAP_OFFSET,
                .poff   = CG3_RAM_OFFSET,
index 0b60df51e7bc033a63c7a82446780cb0494bd1e2..56d74468040a02ddd3dd720f0070590fbb2f598e 100644 (file)
@@ -545,7 +545,7 @@ static int cg6_blank(int blank, struct fb_info *info)
        return 0;
 }
 
-static struct sbus_mmap_map cg6_mmap_map[] = {
+static const struct sbus_mmap_map cg6_mmap_map[] = {
        {
                .voff   = CG6_FBC,
                .poff   = CG6_FBC_OFFSET,
index 0b7e7b38c05ad10eb074a008d5e2d7e30481d8ce..34b6abff9493e30d9fa5e80d2ce77111c9bd096d 100644 (file)
@@ -710,7 +710,7 @@ static int ffb_blank(int blank, struct fb_info *info)
        return 0;
 }
 
-static struct sbus_mmap_map ffb_mmap_map[] = {
+static const struct sbus_mmap_map ffb_mmap_map[] = {
        {
                .voff   = FFB_SFB8R_VOFF,
                .poff   = FFB_SFB8R_POFF,
index 271e2e8c6a846143f5a2bef7456c3736746ec76e..b9fb059df2c700994d73eff582b15e1fdc4869ef 100644 (file)
@@ -338,7 +338,7 @@ static int leo_blank(int blank, struct fb_info *info)
        return 0;
 }
 
-static struct sbus_mmap_map leo_mmap_map[] = {
+static const struct sbus_mmap_map leo_mmap_map[] = {
        {
                .voff   = LEO_SS0_MAP,
                .poff   = LEO_OFF_SS0,
index 124468f0e9efb9919a18957ccff47dcd6eb81fba..0bc0f78fe4b9f4cbf0aa379eaaccb46ef66e6688 100644 (file)
@@ -206,7 +206,7 @@ p9100_blank(int blank, struct fb_info *info)
        return 0;
 }
 
-static struct sbus_mmap_map p9100_mmap_map[] = {
+static const struct sbus_mmap_map p9100_mmap_map[] = {
        { CG3_MMAP_OFFSET,      0,              SBUS_MMAP_FBSIZE(1) },
        { 0,                    0,              0                   }
 };
index 634e3d159452c1619a311b13f22fedd787478563..4c79654bda30e6f141749aac1e8789997f9d6c1d 100644 (file)
@@ -38,7 +38,7 @@ static unsigned long sbusfb_mmapsize(long size, unsigned long fbsize)
        return fbsize * (-size);
 }
 
-int sbusfb_mmap_helper(struct sbus_mmap_map *map,
+int sbusfb_mmap_helper(const struct sbus_mmap_map *map,
                       unsigned long physbase,
                       unsigned long fbsize,
                       unsigned long iospace,
index 6466b4cbcd7b3a6afe2da66bf7688fea566856ea..e9af2dc93f94942bbde104705b0d81d06329c4c8 100644 (file)
@@ -19,7 +19,7 @@ struct sbus_mmap_map {
 
 extern void sbusfb_fill_var(struct fb_var_screeninfo *var,
                            struct device_node *dp, int bpp);
-extern int sbusfb_mmap_helper(struct sbus_mmap_map *map,
+extern int sbusfb_mmap_helper(const struct sbus_mmap_map *map,
                              unsigned long physbase, unsigned long fbsize,
                              unsigned long iospace,
                              struct vm_area_struct *vma);
index 6eb8bb2e3501353c78f76ab59b8eb3ad5804996a..f9a0085ad72bf7f274eea48967d79e10b1dbd2cb 100644 (file)
@@ -236,7 +236,7 @@ tcx_blank(int blank, struct fb_info *info)
        return 0;
 }
 
-static struct sbus_mmap_map __tcx_mmap_map[TCX_MMAP_ENTRIES] = {
+static const struct sbus_mmap_map __tcx_mmap_map[TCX_MMAP_ENTRIES] = {
        {
                .voff   = TCX_RAM8BIT,
                .size   = SBUS_MMAP_FBSIZE(1)