Skip to content

Commit b65bd78

Browse files
tititiou36hdeller
authored andcommitted
fbdev: mmp: Constify struct mmp_overlay_ops
'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 <[email protected]> Signed-off-by: Helge Deller <[email protected]>
1 parent c260bda commit b65bd78

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

drivers/video/fbdev/mmp/hw/mmp_ctrl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ static void path_set_mode(struct mmp_path *path, struct mmp_mode *mode)
313313
mutex_unlock(&path->access_ok);
314314
}
315315

316-
static struct mmp_overlay_ops mmphw_overlay_ops = {
316+
static const struct mmp_overlay_ops mmphw_overlay_ops = {
317317
.set_fetch = overlay_set_fetch,
318318
.set_onoff = overlay_set_onoff,
319319
.set_win = overlay_set_win,

include/video/mmp_disp.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ struct mmp_overlay {
156156
int status;
157157
struct mutex access_ok;
158158

159-
struct mmp_overlay_ops *ops;
159+
const struct mmp_overlay_ops *ops;
160160
};
161161

162162
/* panel type */
@@ -299,7 +299,7 @@ struct mmp_path_info {
299299
int overlay_num;
300300
void (*set_mode)(struct mmp_path *path, struct mmp_mode *mode);
301301
void (*set_onoff)(struct mmp_path *path, int status);
302-
struct mmp_overlay_ops *overlay_ops;
302+
const struct mmp_overlay_ops *overlay_ops;
303303
void *plat_data;
304304
};
305305

0 commit comments

Comments
 (0)