mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Len Bao <len.bao@gmx.us>
To: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>
Cc: Len Bao <len.bao@gmx.us>,
	linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] ALSA: isa: Mark '*_registered' variables as __ro_after_init
Date: Sun, 24 May 2026 15:40:49 +0000	[thread overview]
Message-ID: <20260524154051.45258-1-len.bao@gmx.us> (raw)

The '*_registered' variables are initialized only during the init
phase in the '__init' functions and never changed. So, mark them as
__ro_after_init to reduce the attack surface.

Signed-off-by: Len Bao <len.bao@gmx.us>
---
 sound/isa/cmi8330.c             | 4 ++--
 sound/isa/cs423x/cs4236.c       | 6 +++---
 sound/isa/es18xx.c              | 6 +++---
 sound/isa/gus/interwave.c       | 4 ++--
 sound/isa/msnd/msnd_pinnacle.c  | 4 ++--
 sound/isa/opl3sa2.c             | 6 +++---
 sound/isa/sb/sb16.c             | 4 ++--
 sound/isa/sscape.c              | 4 ++--
 sound/isa/wavefront/wavefront.c | 4 ++--
 9 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c
index 3d1f19321..ecff52195 100644
--- a/sound/isa/cmi8330.c
+++ b/sound/isa/cmi8330.c
@@ -103,8 +103,8 @@ MODULE_PARM_DESC(mpuport, "MPU-401 port # for CMI8330/CMI8329 driver.");
 module_param_hw_array(mpuirq, int, irq, NULL, 0444);
 MODULE_PARM_DESC(mpuirq, "IRQ # for CMI8330/CMI8329 MPU-401 port.");
 #ifdef CONFIG_PNP
-static int isa_registered;
-static int pnp_registered;
+static int isa_registered __ro_after_init;
+static int pnp_registered __ro_after_init;
 #endif
 
 #define CMI8330_RMUX3D    16
diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c
index e36cc1476..238065ffa 100644
--- a/sound/isa/cs423x/cs4236.c
+++ b/sound/isa/cs423x/cs4236.c
@@ -69,9 +69,9 @@ module_param_hw_array(dma2, int, dma, NULL, 0444);
 MODULE_PARM_DESC(dma2, "DMA2 # for " IDENT " driver.");
 
 #ifdef CONFIG_PNP
-static int isa_registered;
-static int pnpc_registered;
-static int pnp_registered;
+static int isa_registered __ro_after_init;
+static int pnpc_registered __ro_after_init;
+static int pnp_registered __ro_after_init;
 #endif /* CONFIG_PNP */
 
 struct snd_card_cs4236 {
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c
index 1da7b400a..df88d91e0 100644
--- a/sound/isa/es18xx.c
+++ b/sound/isa/es18xx.c
@@ -1924,9 +1924,9 @@ module_param_hw_array(dma2, int, dma, NULL, 0444);
 MODULE_PARM_DESC(dma2, "DMA 2 # for ES18xx driver.");
 
 #ifdef CONFIG_PNP
-static int isa_registered;
-static int pnp_registered;
-static int pnpc_registered;
+static int isa_registered __ro_after_init;
+static int pnp_registered __ro_after_init;
+static int pnpc_registered __ro_after_init;
 
 static const struct pnp_device_id snd_audiodrive_pnpbiosids[] = {
 	{ .id = "ESS1869" },
diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c
index 6c3a2977d..115f900fa 100644
--- a/sound/isa/gus/interwave.c
+++ b/sound/isa/gus/interwave.c
@@ -111,8 +111,8 @@ struct snd_interwave {
 
 
 #ifdef CONFIG_PNP
-static int isa_registered;
-static int pnp_registered;
+static int isa_registered __ro_after_init;
+static int pnp_registered __ro_after_init;
 
 static const struct pnp_card_device_id snd_interwave_pnpids[] = {
 #ifndef SNDRV_STB
diff --git a/sound/isa/msnd/msnd_pinnacle.c b/sound/isa/msnd/msnd_pinnacle.c
index 5b729bb02..0d5f4461a 100644
--- a/sound/isa/msnd/msnd_pinnacle.c
+++ b/sound/isa/msnd/msnd_pinnacle.c
@@ -1199,8 +1199,8 @@ static int snd_msnd_pnp_resume(struct pnp_card_link *pcard)
 }
 #endif
 
-static int isa_registered;
-static int pnp_registered;
+static int isa_registered __ro_after_init;
+static int pnp_registered __ro_after_init;
 
 static const struct pnp_card_device_id msnd_pnpids[] = {
 	/* Pinnacle PnP */
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c
index 8c1767697..88eada933 100644
--- a/sound/isa/opl3sa2.c
+++ b/sound/isa/opl3sa2.c
@@ -69,9 +69,9 @@ module_param_array(opl3sa3_ymode, int, NULL, 0444);
 MODULE_PARM_DESC(opl3sa3_ymode, "Speaker size selection for 3D Enhancement mode: Desktop/Large Notebook/Small Notebook/HiFi.");
 
 #ifdef CONFIG_PNP
-static int isa_registered;
-static int pnp_registered;
-static int pnpc_registered;
+static int isa_registered __ro_after_init;
+static int pnp_registered __ro_after_init;
+static int pnpc_registered __ro_after_init;
 #endif
 
 /* control ports */
diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c
index 208d1942a..866d7f5c5 100644
--- a/sound/isa/sb/sb16.c
+++ b/sound/isa/sb/sb16.c
@@ -99,8 +99,8 @@ MODULE_PARM_DESC(seq_ports, "Number of sequencer ports for WaveTable synth.");
 #endif
 
 #ifdef CONFIG_PNP
-static int isa_registered;
-static int pnp_registered;
+static int isa_registered __ro_after_init;
+static int pnp_registered __ro_after_init;
 #endif
 
 struct snd_card_sb16 {
diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c
index 553ceb92d..ce8a59650 100644
--- a/sound/isa/sscape.c
+++ b/sound/isa/sscape.c
@@ -71,8 +71,8 @@ module_param_array(joystick, bool, NULL, 0444);
 MODULE_PARM_DESC(joystick, "Enable gameport.");
 
 #ifdef CONFIG_PNP
-static int isa_registered;
-static int pnp_registered;
+static int isa_registered __ro_after_init;
+static int pnp_registered __ro_after_init;
 
 static const struct pnp_card_device_id sscape_pnpids[] = {
 	{ .id = "ENS3081", .devs = { { "ENS0000" } } }, /* Soundscape PnP */
diff --git a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c
index 07c685680..cacc1479b 100644
--- a/sound/isa/wavefront/wavefront.c
+++ b/sound/isa/wavefront/wavefront.c
@@ -71,8 +71,8 @@ module_param_array(use_cs4232_midi, bool, NULL, 0444);
 MODULE_PARM_DESC(use_cs4232_midi, "Use CS4232 MPU-401 interface (inaccessibly located inside your computer)");
 
 #ifdef CONFIG_PNP
-static int isa_registered;
-static int pnp_registered;
+static int isa_registered __ro_after_init;
+static int pnp_registered __ro_after_init;
 
 static const struct pnp_card_device_id snd_wavefront_pnpids[] = {
 	/* Tropez */
-- 
2.43.0


             reply	other threads:[~2026-05-24 15:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-24 15:40 Len Bao [this message]
2026-05-25  7:32 ` Takashi Iwai

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=20260524154051.45258-1-len.bao@gmx.us \
    --to=len.bao@gmx.us \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /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 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®