mbox series

[PATCH/RFC,0/3] Constify drm_driver

Message ID 20200222152430.2984-1-laurent.pinchart+renesas@ideasonboard.com (mailing list archive)
Headers show
Series Constify drm_driver | expand


Laurent Pinchart Feb. 22, 2020, 3:24 p.m. UTC

This patch series makes it possible for DRM drivers to declare their
struct drm_driver as a static const. This improves security by avoiding
function pointers in writable memory.

The change turned out to be fairly easy, with preparation in patch 1/3
that moves the only non-const field out of drm_driver, and patch 2/3
that performs the constification in the DRM core. Patch 3/3 is an
example of driver conversion to const drm_driver. If the series is
accepted, I'll write a coccinelle patch that handles all drivers.

Laurent Pinchart (3):
  drm: Move legacy device list out of drm_driver
  drm: Use a const drm_driver through the DRM core
  drm: rcar_du: Constify drm_driver

 drivers/gpu/drm/drm_drv.c                | 10 +++----
 drivers/gpu/drm/drm_pci.c                | 38 +++++++++++++++++-------
 drivers/gpu/drm/drm_vram_helper_common.c |  4 +--
 drivers/gpu/drm/rcar-du/rcar_du_drv.c    |  2 +-
 include/drm/drm_device.h                 |  4 ++-
 include/drm/drm_drv.h                    |  8 ++---
 include/drm/drm_legacy.h                 | 10 ++++---
 include/drm/drm_pci.h                    |  4 +--
 8 files changed, 49 insertions(+), 31 deletions(-)