Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm: Constify drm_driver in drivers that don't modify it

A non-const structure containing function pointers is a possible attack
vector. The drm_driver structure is already const in most drivers, but
there are a few exceptions. Constify the structure in the drivers that
don't need to modify at, as a low-hanging fruit. The rest of the drivers
will need a more complex fix.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

+3 -3
+1 -1
drivers/gpu/drm/arc/arcpgu_drv.c
··· 145 145 } 146 146 #endif 147 147 148 - static struct drm_driver arcpgu_drm_driver = { 148 + static const struct drm_driver arcpgu_drm_driver = { 149 149 .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC, 150 150 .name = "arcpgu", 151 151 .desc = "ARC PGU Controller",
+1 -1
drivers/gpu/drm/kmb/kmb_drv.c
··· 400 400 401 401 DEFINE_DRM_GEM_CMA_FOPS(fops); 402 402 403 - static struct drm_driver kmb_driver = { 403 + static const struct drm_driver kmb_driver = { 404 404 .driver_features = DRIVER_GEM | 405 405 DRIVER_MODESET | DRIVER_ATOMIC, 406 406 .irq_handler = kmb_isr,
+1 -1
drivers/gpu/drm/tdfx/tdfx_drv.c
··· 56 56 .llseek = noop_llseek, 57 57 }; 58 58 59 - static struct drm_driver driver = { 59 + static const struct drm_driver driver = { 60 60 .driver_features = DRIVER_LEGACY, 61 61 .fops = &tdfx_driver_fops, 62 62 .name = DRIVER_NAME,