Message ID | 20200222152430.2984-4-laurent.pinchart+renesas@ideasonboard.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Constify drm_driver | expand |
On Sat, Feb 22, 2020 at 05:24:30PM +0200, Laurent Pinchart wrote: > The drm_driver structure is never modified, make it const. The improves > security by avoiding writable function pointers. > > Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> I wonder whether there's some magic somewhere we could do to enlist the cocci army to create the constify patches for us ... Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> > --- > drivers/gpu/drm/rcar-du/rcar_du_drv.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c > index 654e2dd08146..039eee3ef661 100644 > --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c > +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c > @@ -474,7 +474,7 @@ MODULE_DEVICE_TABLE(of, rcar_du_of_table); > > DEFINE_DRM_GEM_CMA_FOPS(rcar_du_fops); > > -static struct drm_driver rcar_du_driver = { > +static const struct drm_driver rcar_du_driver = { > .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC, > .gem_free_object_unlocked = drm_gem_cma_free_object, > .gem_vm_ops = &drm_gem_cma_vm_ops, > -- > Regards, > > Laurent Pinchart >
Thanks Laurent for sorting this out. On Sat, 22 Feb 2020 at 17:59, Daniel Vetter <daniel@ffwll.ch> wrote: > > On Sat, Feb 22, 2020 at 05:24:30PM +0200, Laurent Pinchart wrote: > > The drm_driver structure is never modified, make it const. The improves > > security by avoiding writable function pointers. > > > > Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> > > I wonder whether there's some magic somewhere we could do to enlist the > cocci army to create the constify patches for us ... > IIRC some drivers still manually thinker with their struct drm_driver ;-) That said, the series looks good: Reviewed-by: Emil Velikov <emil.velikov@collabora.com> -Emil
Hi Emil, On Mon, Feb 24, 2020 at 03:26:05PM +0000, Emil Velikov wrote: > Thanks Laurent for sorting this out. You're welcome. It's been bothering me for some time :-) > On Sat, 22 Feb 2020 at 17:59, Daniel Vetter <daniel@ffwll.ch> wrote: > > On Sat, Feb 22, 2020 at 05:24:30PM +0200, Laurent Pinchart wrote: > > > The drm_driver structure is never modified, make it const. The improves > > > security by avoiding writable function pointers. > > > > > > Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> > > > > I wonder whether there's some magic somewhere we could do to enlist the > > cocci army to create the constify patches for us ... > > > IIRC some drivers still manually thinker with their struct drm_driver ;-) > > That said, the series looks good: > Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Does this apply to the whole series, or to this patch only ?
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c index 654e2dd08146..039eee3ef661 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c @@ -474,7 +474,7 @@ MODULE_DEVICE_TABLE(of, rcar_du_of_table); DEFINE_DRM_GEM_CMA_FOPS(rcar_du_fops); -static struct drm_driver rcar_du_driver = { +static const struct drm_driver rcar_du_driver = { .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC, .gem_free_object_unlocked = drm_gem_cma_free_object, .gem_vm_ops = &drm_gem_cma_vm_ops,
The drm_driver structure is never modified, make it const. The improves security by avoiding writable function pointers. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> --- drivers/gpu/drm/rcar-du/rcar_du_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)