mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/radeon: Constify struct pci_device_id
@ 2024-11-15 17:26 Christophe JAILLET
  2024-11-18 11:24 ` Christian König
  0 siblings, 1 reply; 3+ messages in thread
From: Christophe JAILLET @ 2024-11-15 17:26 UTC (permalink / raw)
  To: linux, broonie, lee, Alex Deucher, Christian König,
	Xinhui Pan, David Airlie, Simona Vetter
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, amd-gfx, dri-devel

'struct pci_device_id' 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:
Before:
======
   text	   data	    bss	    dec	    hex	filename
  11984	  28672	     44	  40700	   9efc	drivers/gpu/drm/radeon/radeon_drv.o

After:
=====
   text	   data	    bss	    dec	    hex	filename
  40000	    664	     44	  40708	   9f04	drivers/gpu/drm/radeon/radeon_drv.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested-only.
---
 drivers/gpu/drm/radeon/radeon_drv.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index 23d6d1a2586d..5e958cc223f4 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -248,10 +248,9 @@ int radeon_cik_support = 1;
 MODULE_PARM_DESC(cik_support, "CIK support (1 = enabled (default), 0 = disabled)");
 module_param_named(cik_support, radeon_cik_support, int, 0444);
 
-static struct pci_device_id pciidlist[] = {
+static const struct pci_device_id pciidlist[] = {
 	radeon_PCI_IDS
 };
-
 MODULE_DEVICE_TABLE(pci, pciidlist);
 
 static const struct drm_driver kms_driver;
-- 
2.47.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/radeon: Constify struct pci_device_id
  2024-11-15 17:26 [PATCH] drm/radeon: Constify struct pci_device_id Christophe JAILLET
@ 2024-11-18 11:24 ` Christian König
  2024-11-18 15:26   ` Alex Deucher
  0 siblings, 1 reply; 3+ messages in thread
From: Christian König @ 2024-11-18 11:24 UTC (permalink / raw)
  To: Christophe JAILLET, linux, broonie, lee, Alex Deucher,
	Xinhui Pan, David Airlie, Simona Vetter
  Cc: linux-kernel, kernel-janitors, amd-gfx, dri-devel

Am 15.11.24 um 18:26 schrieb Christophe JAILLET:
> 'struct pci_device_id' 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:
> Before:
> ======
>     text	   data	    bss	    dec	    hex	filename
>    11984	  28672	     44	  40700	   9efc	drivers/gpu/drm/radeon/radeon_drv.o
>
> After:
> =====
>     text	   data	    bss	    dec	    hex	filename
>    40000	    664	     44	  40708	   9f04	drivers/gpu/drm/radeon/radeon_drv.o

Mhm that's a bit more than "some data" :)

> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Acked-by: Christian König <christian.koenig@amd.com>

> ---
> Compile tested-only.
> ---
>   drivers/gpu/drm/radeon/radeon_drv.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
> index 23d6d1a2586d..5e958cc223f4 100644
> --- a/drivers/gpu/drm/radeon/radeon_drv.c
> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> @@ -248,10 +248,9 @@ int radeon_cik_support = 1;
>   MODULE_PARM_DESC(cik_support, "CIK support (1 = enabled (default), 0 = disabled)");
>   module_param_named(cik_support, radeon_cik_support, int, 0444);
>   
> -static struct pci_device_id pciidlist[] = {
> +static const struct pci_device_id pciidlist[] = {
>   	radeon_PCI_IDS
>   };
> -
>   MODULE_DEVICE_TABLE(pci, pciidlist);
>   
>   static const struct drm_driver kms_driver;


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/radeon: Constify struct pci_device_id
  2024-11-18 11:24 ` Christian König
@ 2024-11-18 15:26   ` Alex Deucher
  0 siblings, 0 replies; 3+ messages in thread
From: Alex Deucher @ 2024-11-18 15:26 UTC (permalink / raw)
  To: Christian König
  Cc: Christophe JAILLET, linux, broonie, lee, Alex Deucher,
	Xinhui Pan, David Airlie, Simona Vetter, linux-kernel,
	kernel-janitors, amd-gfx, dri-devel

Applied.  Thanks!

Alex

On Mon, Nov 18, 2024 at 6:25 AM Christian König
<christian.koenig@amd.com> wrote:
>
> Am 15.11.24 um 18:26 schrieb Christophe JAILLET:
> > 'struct pci_device_id' 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:
> > Before:
> > ======
> >     text         data     bss     dec     hex filename
> >    11984        28672      44   40700    9efc drivers/gpu/drm/radeon/radeon_drv.o
> >
> > After:
> > =====
> >     text         data     bss     dec     hex filename
> >    40000          664      44   40708    9f04 drivers/gpu/drm/radeon/radeon_drv.o
>
> Mhm that's a bit more than "some data" :)
>
> > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>
> Acked-by: Christian König <christian.koenig@amd.com>
>
> > ---
> > Compile tested-only.
> > ---
> >   drivers/gpu/drm/radeon/radeon_drv.c | 3 +--
> >   1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
> > index 23d6d1a2586d..5e958cc223f4 100644
> > --- a/drivers/gpu/drm/radeon/radeon_drv.c
> > +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> > @@ -248,10 +248,9 @@ int radeon_cik_support = 1;
> >   MODULE_PARM_DESC(cik_support, "CIK support (1 = enabled (default), 0 = disabled)");
> >   module_param_named(cik_support, radeon_cik_support, int, 0444);
> >
> > -static struct pci_device_id pciidlist[] = {
> > +static const struct pci_device_id pciidlist[] = {
> >       radeon_PCI_IDS
> >   };
> > -
> >   MODULE_DEVICE_TABLE(pci, pciidlist);
> >
> >   static const struct drm_driver kms_driver;
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-11-18 15:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-15 17:26 [PATCH] drm/radeon: Constify struct pci_device_id Christophe JAILLET
2024-11-18 11:24 ` Christian König
2024-11-18 15:26   ` Alex Deucher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®