All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Cc: Anitha Chrisanthus <anitha.chrisanthus@intel.com>,
	Alexey Brodkin <abrodkin@synopsys.com>,
	Edmund Dea <edmund.j.dea@intel.com>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 3/3] drm: Constify drm_driver in drivers that don't modify it
Date: Wed, 16 Dec 2020 15:32:00 +0100	[thread overview]
Message-ID: <X9oaYCLtjYgJuYz/@phenom.ffwll.local> (raw)
In-Reply-To: <20201215203126.10175-4-laurent.pinchart+renesas@ideasonboard.com>

On Tue, Dec 15, 2020 at 10:31:26PM +0200, Laurent Pinchart wrote:
> 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>

> ---
>  drivers/gpu/drm/arc/arcpgu_drv.c | 2 +-
>  drivers/gpu/drm/kmb/kmb_drv.c    | 2 +-
>  drivers/gpu/drm/tdfx/tdfx_drv.c  | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c
> index f164818ec477..077d006b1fbf 100644
> --- a/drivers/gpu/drm/arc/arcpgu_drv.c
> +++ b/drivers/gpu/drm/arc/arcpgu_drv.c
> @@ -145,7 +145,7 @@ static void arcpgu_debugfs_init(struct drm_minor *minor)
>  }
>  #endif
>  
> -static struct drm_driver arcpgu_drm_driver = {
> +static const struct drm_driver arcpgu_drm_driver = {
>  	.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
>  	.name = "arcpgu",
>  	.desc = "ARC PGU Controller",
> diff --git a/drivers/gpu/drm/kmb/kmb_drv.c b/drivers/gpu/drm/kmb/kmb_drv.c
> index a31a840ce634..3c49668ec946 100644
> --- a/drivers/gpu/drm/kmb/kmb_drv.c
> +++ b/drivers/gpu/drm/kmb/kmb_drv.c
> @@ -400,7 +400,7 @@ static void kmb_irq_reset(struct drm_device *drm)
>  
>  DEFINE_DRM_GEM_CMA_FOPS(fops);
>  
> -static struct drm_driver kmb_driver = {
> +static const struct drm_driver kmb_driver = {
>  	.driver_features = DRIVER_GEM |
>  	    DRIVER_MODESET | DRIVER_ATOMIC,
>  	.irq_handler = kmb_isr,
> diff --git a/drivers/gpu/drm/tdfx/tdfx_drv.c b/drivers/gpu/drm/tdfx/tdfx_drv.c
> index ab699bf0ac5c..58c185c299f4 100644
> --- a/drivers/gpu/drm/tdfx/tdfx_drv.c
> +++ b/drivers/gpu/drm/tdfx/tdfx_drv.c
> @@ -56,7 +56,7 @@ static const struct file_operations tdfx_driver_fops = {
>  	.llseek = noop_llseek,
>  };
>  
> -static struct drm_driver driver = {
> +static const struct drm_driver driver = {
>  	.driver_features = DRIVER_LEGACY,
>  	.fops = &tdfx_driver_fops,
>  	.name = DRIVER_NAME,
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

      reply	other threads:[~2020-12-16 14:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-15 20:31 [PATCH v2 0/3] Finish constification of drm_driver in DRM core Laurent Pinchart
2020-12-15 20:31 ` [PATCH v2 1/3] drm: Move legacy device list out of drm_driver Laurent Pinchart
2020-12-16 14:28   ` Daniel Vetter
2020-12-15 20:31 ` [PATCH v2 2/3] drm: Use a const drm_driver for legacy PCI devices Laurent Pinchart
2020-12-16 14:29   ` Daniel Vetter
2020-12-16 14:31     ` Laurent Pinchart
2020-12-15 20:31 ` [PATCH v2 3/3] drm: Constify drm_driver in drivers that don't modify it Laurent Pinchart
2020-12-16 14:32   ` Daniel Vetter [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=X9oaYCLtjYgJuYz/@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=abrodkin@synopsys.com \
    --cc=anitha.chrisanthus@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=edmund.j.dea@intel.com \
    --cc=laurent.pinchart+renesas@ideasonboard.com \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.