Skip to content

Commit 161e95b

Browse files
tititiou36hdeller
authored andcommitted
fbdev: Constify struct sbus_mmap_map
'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 <[email protected]> Signed-off-by: Helge Deller <[email protected]>
1 parent 57e755d commit 161e95b

File tree

10 files changed

+10
-10
lines changed

10 files changed

+10
-10
lines changed

drivers/video/fbdev/bw2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ bw2_blank(int blank, struct fb_info *info)
147147
return 0;
148148
}
149149

150-
static struct sbus_mmap_map bw2_mmap_map[] = {
150+
static const struct sbus_mmap_map bw2_mmap_map[] = {
151151
{
152152
.size = SBUS_MMAP_FBSIZE(1)
153153
},

drivers/video/fbdev/cg14.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ static void cg14_init_fix(struct fb_info *info, int linebytes,
360360
info->fix.accel = FB_ACCEL_SUN_CG14;
361361
}
362362

363-
static struct sbus_mmap_map __cg14_mmap_map[CG14_MMAP_ENTRIES] = {
363+
static const struct sbus_mmap_map __cg14_mmap_map[CG14_MMAP_ENTRIES] = {
364364
{
365365
.voff = CG14_REGS,
366366
.poff = 0x80000000,

drivers/video/fbdev/cg3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ static int cg3_blank(int blank, struct fb_info *info)
209209
return 0;
210210
}
211211

212-
static struct sbus_mmap_map cg3_mmap_map[] = {
212+
static const struct sbus_mmap_map cg3_mmap_map[] = {
213213
{
214214
.voff = CG3_MMAP_OFFSET,
215215
.poff = CG3_RAM_OFFSET,

drivers/video/fbdev/cg6.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ static int cg6_blank(int blank, struct fb_info *info)
545545
return 0;
546546
}
547547

548-
static struct sbus_mmap_map cg6_mmap_map[] = {
548+
static const struct sbus_mmap_map cg6_mmap_map[] = {
549549
{
550550
.voff = CG6_FBC,
551551
.poff = CG6_FBC_OFFSET,

drivers/video/fbdev/ffb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ static int ffb_blank(int blank, struct fb_info *info)
710710
return 0;
711711
}
712712

713-
static struct sbus_mmap_map ffb_mmap_map[] = {
713+
static const struct sbus_mmap_map ffb_mmap_map[] = {
714714
{
715715
.voff = FFB_SFB8R_VOFF,
716716
.poff = FFB_SFB8R_POFF,

drivers/video/fbdev/leo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ static int leo_blank(int blank, struct fb_info *info)
338338
return 0;
339339
}
340340

341-
static struct sbus_mmap_map leo_mmap_map[] = {
341+
static const struct sbus_mmap_map leo_mmap_map[] = {
342342
{
343343
.voff = LEO_SS0_MAP,
344344
.poff = LEO_OFF_SS0,

drivers/video/fbdev/p9100.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ p9100_blank(int blank, struct fb_info *info)
206206
return 0;
207207
}
208208

209-
static struct sbus_mmap_map p9100_mmap_map[] = {
209+
static const struct sbus_mmap_map p9100_mmap_map[] = {
210210
{ CG3_MMAP_OFFSET, 0, SBUS_MMAP_FBSIZE(1) },
211211
{ 0, 0, 0 }
212212
};

drivers/video/fbdev/sbuslib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ static unsigned long sbusfb_mmapsize(long size, unsigned long fbsize)
3838
return fbsize * (-size);
3939
}
4040

41-
int sbusfb_mmap_helper(struct sbus_mmap_map *map,
41+
int sbusfb_mmap_helper(const struct sbus_mmap_map *map,
4242
unsigned long physbase,
4343
unsigned long fbsize,
4444
unsigned long iospace,

drivers/video/fbdev/sbuslib.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ struct sbus_mmap_map {
1919

2020
extern void sbusfb_fill_var(struct fb_var_screeninfo *var,
2121
struct device_node *dp, int bpp);
22-
extern int sbusfb_mmap_helper(struct sbus_mmap_map *map,
22+
extern int sbusfb_mmap_helper(const struct sbus_mmap_map *map,
2323
unsigned long physbase, unsigned long fbsize,
2424
unsigned long iospace,
2525
struct vm_area_struct *vma);

drivers/video/fbdev/tcx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ tcx_blank(int blank, struct fb_info *info)
236236
return 0;
237237
}
238238

239-
static struct sbus_mmap_map __tcx_mmap_map[TCX_MMAP_ENTRIES] = {
239+
static const struct sbus_mmap_map __tcx_mmap_map[TCX_MMAP_ENTRIES] = {
240240
{
241241
.voff = TCX_RAM8BIT,
242242
.size = SBUS_MMAP_FBSIZE(1)

0 commit comments

Comments
 (0)